@Override public void toComposite( final DynamicComposite composite, final Id value ) { composite.addComponent( value.getUuid(), UUID_SERIALIZER ); composite.addComponent( value.getType(), STRING_SERIALIZER ); }
@Override public ByteBuffer toByteBuffer(final Shard shard ) { DynamicComposite composite = new DynamicComposite(); composite.addComponent( (byte) 2 , BYTE_SERIALIZER); composite.addComponent( shard.getShardIndex(), LONG_SERIALIZER); composite.addComponent( shard.getCreatedTime(), LONG_SERIALIZER); if(shard.getShardEnd().isPresent()) { composite.addComponent(shard.getShardEnd().get(), EDGE_SERIALIZER); }else{ composite.addComponent(null, EDGE_SERIALIZER); } composite.addComponent( shard.isCompacted(), BOOLEAN_SERIALIZER); composite.addComponent( shard.isDeleted(), BOOLEAN_SERIALIZER); return composite.serialize(); }
/** * Create a scan range that represents the timestamp of the edge * @param timestamp * @return */ public ByteBuffer fromTimeRange( final long timestamp ) { DynamicComposite composite = new DynamicComposite(); composite.addComponent( timestamp, LONG_SERIALIZER ); return composite.serialize(); } }
@Override public ByteBuffer toByteBuffer( final UniqueFieldEntry value ) { final UUID version = value.getVersion(); final Field<?> field = value.getField(); final FieldTypeName fieldType = field.getTypeName(); final String fieldValue = field.getValue().toString().toLowerCase(); DynamicComposite composite = new DynamicComposite( ); //we want to sort ascending to descending by version composite.addComponent( version, UUID_SERIALIZER, ColumnTypes.UUID_TYPE_REVERSED); composite.addComponent( field.getName(), STRING_SERIALIZER ); composite.addComponent( fieldValue, STRING_SERIALIZER ); composite.addComponent( fieldType.name() , STRING_SERIALIZER); return composite.serialize(); }
@Override public ByteBuffer toByteBuffer( final DirectedEdge edge ) { DynamicComposite composite = new DynamicComposite(); composite.addComponent( edge.timestamp, LONG_SERIALIZER ); ID_COL_SERIALIZER.toComposite( composite, edge.id ); return composite.serialize(); }