private void appendClause(PartitionPosition pos, StringBuilder sb, CFMetaData metadata, boolean isStart, boolean isInclusive) { sb.append("token("); sb.append(ColumnDefinition.toCQLString(metadata.partitionKeyColumns())); sb.append(") ").append(getOperator(isStart, isInclusive)).append(" "); if (pos instanceof DecoratedKey) { sb.append("token("); appendKeyString(sb, metadata.getKeyValidator(), ((DecoratedKey)pos).getKey()); sb.append(")"); } else { sb.append(((Token.KeyBound)pos).getToken()); } }
public static class TokenSerializer implements ISerializer<Token> { public void serialize(Token token, DataOutputPlus out) throws IOException { IPartitioner p = StorageService.getPartitioner(); ByteBuffer b = p.getTokenFactory().toByteArray(token); ByteBufferUtil.writeWithLength(b, out); } public Token deserialize(DataInput in) throws IOException { IPartitioner p = StorageService.getPartitioner(); int size = in.readInt(); byte[] bytes = new byte[size]; in.readFully(bytes); return p.getTokenFactory().fromByteArray(ByteBuffer.wrap(bytes)); } public long serializedSize(Token object, TypeSizes typeSizes) { IPartitioner p = StorageService.getPartitioner(); ByteBuffer b = p.getTokenFactory().toByteArray(object); return TypeSizes.NATIVE.sizeof(b.remaining()) + b.remaining(); } }
private void appendClause(PartitionPosition pos, StringBuilder sb, CFMetaData metadata, boolean isStart, boolean isInclusive) { sb.append("token("); sb.append(ColumnDefinition.toCQLString(metadata.partitionKeyColumns())); sb.append(") ").append(getOperator(isStart, isInclusive)).append(" "); if (pos instanceof DecoratedKey) { sb.append("token("); appendKeyString(sb, metadata.getKeyValidator(), ((DecoratedKey)pos).getKey()); sb.append(")"); } else { sb.append(((Token.KeyBound)pos).getToken()); } }
private void appendClause(PartitionPosition pos, StringBuilder sb, CFMetaData metadata, boolean isStart, boolean isInclusive) { sb.append("token("); sb.append(ColumnDefinition.toCQLString(metadata.partitionKeyColumns())); sb.append(") ").append(getOperator(isStart, isInclusive)).append(" "); if (pos instanceof DecoratedKey) { sb.append("token("); appendKeyString(sb, metadata.getKeyValidator(), ((DecoratedKey)pos).getKey()); sb.append(")"); } else { sb.append(((Token.KeyBound)pos).getToken()); } }
private void appendClause(PartitionPosition pos, StringBuilder sb, CFMetaData metadata, boolean isStart, boolean isInclusive) { sb.append("token("); sb.append(ColumnDefinition.toCQLString(metadata.partitionKeyColumns())); sb.append(") ").append(getOperator(isStart, isInclusive)).append(" "); if (pos instanceof DecoratedKey) { sb.append("token("); appendKeyString(sb, metadata.getKeyValidator(), ((DecoratedKey)pos).getKey()); sb.append(")"); } else { sb.append(((Token.KeyBound)pos).getToken()); } }
public IPartitioner getPartitioner() { return getToken().getPartitioner(); }
public KeyBound minValue() { return getPartitioner().getMinimumToken().minKeyBound(); }
public KeyBound minValue() { return getPartitioner().getMinimumToken().minKeyBound(); }
public boolean isMinimum() { return getToken().isMinimum(); }
public IPartitioner getPartitioner() { return getToken().getPartitioner(); }
public boolean isMinimum(IPartitioner partitioner) { return getToken().isMinimum(partitioner); }
public KeyBound maxKeyBound() { /* * For each token, we needs both minKeyBound and maxKeyBound * because a token corresponds to a range of keys. But the minimun * token corresponds to no key, so it is valid and actually much * simpler to associate the same value for minKeyBound and * maxKeyBound for the minimun token. */ if (isMinimum()) return minKeyBound(); return new KeyBound(this, false); }
public boolean isMinimum() { return getToken().isMinimum(); }
public KeyBound maxKeyBound() { /* * For each token, we needs both minKeyBound and maxKeyBound * because a token corresponds to a range of keys. But the minimun * token corresponds to no key, so it is valid and actually much * simpler to associate the same value for minKeyBound and * maxKeyBound for the minimun token. */ if (isMinimum()) return minKeyBound(); return new KeyBound(this, false); }
public KeyBound minKeyBound() { return new KeyBound(this, true); }
public KeyBound minKeyBound() { return new KeyBound(this, true); }
public boolean isMinimum() { return getToken().isMinimum(); }
public IPartitioner getPartitioner() { return getToken().getPartitioner(); }
public KeyBound maxKeyBound() { /* * For each token, we needs both minKeyBound and maxKeyBound * because a token corresponds to a range of keys. But the minimun * token corresponds to no key, so it is valid and actually much * simpler to associate the same value for minKeyBound and * maxKeyBound for the minimun token. */ if (isMinimum()) return minKeyBound(); return new KeyBound(this, false); }
public KeyBound minValue() { return getPartitioner().getMinimumToken().minKeyBound(); }