use of com.thinkaurelius.titan.diskstorage.WriteBuffer in project titan by thinkaurelius.
the class ConsistentKeyLockerSerializer method toLockKey.
public StaticBuffer toLockKey(StaticBuffer key, StaticBuffer column) {
WriteBuffer b = new WriteByteBuffer(key.length() + column.length() + 4);
b.putInt(key.length());
WriteBufferUtil.put(b, key);
WriteBufferUtil.put(b, column);
return b.getStaticBuffer();
}
use of com.thinkaurelius.titan.diskstorage.WriteBuffer in project titan by thinkaurelius.
the class ConsistentKeyLockerSerializer method toLockCol.
public StaticBuffer toLockCol(Instant ts, StaticBuffer rid, TimestampProvider provider) {
WriteBuffer b = new WriteByteBuffer(rid.length() + 8);
b.putLong(provider.getTime(ts));
WriteBufferUtil.put(b, rid);
return b.getStaticBuffer();
}
use of com.thinkaurelius.titan.diskstorage.WriteBuffer in project titan by thinkaurelius.
the class IDManagementTest method getBufferOf.
private static StaticBuffer getBufferOf(int s, long l) {
WriteBuffer out = new WriteByteBuffer(4 + 8);
out.putInt(s);
out.putLong(l);
return out.getStaticBuffer();
}
use of com.thinkaurelius.titan.diskstorage.WriteBuffer in project titan by thinkaurelius.
the class IDManagementTest method writingInlineEdgeTypes.
@Test
public void writingInlineEdgeTypes() {
int numTries = 100;
WriteBuffer out = new WriteByteBuffer(8 * numTries);
for (SystemRelationType t : SYSTEM_TYPES) {
IDHandler.writeInlineRelationType(out, t.longId());
}
for (long i = 1; i <= numTries; i++) {
IDHandler.writeInlineRelationType(out, IDManager.getSchemaId(IDManager.VertexIDType.UserEdgeLabel, i * 1000));
}
ReadBuffer in = out.getStaticBuffer().asReadBuffer();
for (SystemRelationType t : SYSTEM_TYPES) {
assertEquals(t, SystemTypeManager.getSystemType(IDHandler.readInlineRelationType(in)));
}
for (long i = 1; i <= numTries; i++) {
assertEquals(i * 1000, IDManager.stripEntireRelationTypePadding(IDHandler.readInlineRelationType(in)));
}
}
use of com.thinkaurelius.titan.diskstorage.WriteBuffer in project titan by thinkaurelius.
the class VariableLong method positiveBuffer.
public static StaticBuffer positiveBuffer(final long value) {
WriteBuffer buffer = new WriteByteBuffer(positiveLength(value));
writePositive(buffer, value);
return buffer.getStaticBuffer();
}
Aggregations