Search in sources :

Example 16 with WriteByteBuffer

use of org.janusgraph.diskstorage.util.WriteByteBuffer in project janusgraph by JanusGraph.

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();
}
Also used : WriteBuffer(org.janusgraph.diskstorage.WriteBuffer) WriteByteBuffer(org.janusgraph.diskstorage.util.WriteByteBuffer)

Example 17 with WriteByteBuffer

use of org.janusgraph.diskstorage.util.WriteByteBuffer in project janusgraph by JanusGraph.

the class StaticArrayEntryTest method testTTLMetadata.

@Test
public void testTTLMetadata() {
    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));
}
Also used : WriteBuffer(org.janusgraph.diskstorage.WriteBuffer) WriteByteBuffer(org.janusgraph.diskstorage.util.WriteByteBuffer) StaticArrayEntry(org.janusgraph.diskstorage.util.StaticArrayEntry) Test(org.junit.jupiter.api.Test)

Aggregations

WriteByteBuffer (org.janusgraph.diskstorage.util.WriteByteBuffer)17 WriteBuffer (org.janusgraph.diskstorage.WriteBuffer)14 Test (org.junit.jupiter.api.Test)10 ReadBuffer (org.janusgraph.diskstorage.ReadBuffer)7 StaticBuffer (org.janusgraph.diskstorage.StaticBuffer)3 StaticArrayEntry (org.janusgraph.diskstorage.util.StaticArrayEntry)3 UUID (java.util.UUID)2 Entry (org.janusgraph.diskstorage.Entry)2 ReadArrayBuffer (org.janusgraph.diskstorage.util.ReadArrayBuffer)2 Preconditions (com.google.common.base.Preconditions)1 Random (java.util.Random)1 StopWatch (org.apache.commons.lang3.time.StopWatch)1 IDHandler (org.janusgraph.graphdb.database.idhandling.IDHandler)1 VariableLong (org.janusgraph.graphdb.database.idhandling.VariableLong)1 DataOutput (org.janusgraph.graphdb.database.serialize.DataOutput)1 Serializer (org.janusgraph.graphdb.database.serialize.Serializer)1 StandardSerializer (org.janusgraph.graphdb.database.serialize.StandardSerializer)1 RelationCategory (org.janusgraph.graphdb.internal.RelationCategory)1 SystemRelationType (org.janusgraph.graphdb.types.system.SystemRelationType)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1