use of com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer 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.util.WriteByteBuffer in project titan by thinkaurelius.
the class StaticArrayEntryTest method testTTLMetadata.
@Test
public void testTTLMetadata() throws Exception {
WriteBuffer wb = new WriteByteBuffer(128);
wb.putInt(1).putInt(2).putInt(3).putInt(4);
int valuePos = wb.getPosition();
wb.putInt(5).putInt(6);
StaticArrayEntry entry = new StaticArrayEntry(wb.getStaticBuffer(), valuePos);
entry.setMetaData(EntryMetaData.TTL, 42);
assertEquals(42, entry.getMetaData().get(EntryMetaData.TTL));
}
use of com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer 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.util.WriteByteBuffer 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.util.WriteByteBuffer 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