Search in sources :

Example 11 with WriteByteBuffer

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

Example 12 with WriteByteBuffer

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));
}
Also used : WriteByteBuffer(com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer) StaticArrayEntry(com.thinkaurelius.titan.diskstorage.util.StaticArrayEntry) Test(org.junit.Test)

Example 13 with WriteByteBuffer

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

Example 14 with WriteByteBuffer

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)));
    }
}
Also used : ReadBuffer(com.thinkaurelius.titan.diskstorage.ReadBuffer) WriteBuffer(com.thinkaurelius.titan.diskstorage.WriteBuffer) WriteByteBuffer(com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer) Test(org.junit.Test)

Example 15 with WriteByteBuffer

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

Aggregations

WriteByteBuffer (com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer)18 WriteBuffer (com.thinkaurelius.titan.diskstorage.WriteBuffer)14 Test (org.junit.Test)7 ReadBuffer (com.thinkaurelius.titan.diskstorage.ReadBuffer)4 StaticArrayEntry (com.thinkaurelius.titan.diskstorage.util.StaticArrayEntry)3 StaticBuffer (com.thinkaurelius.titan.diskstorage.StaticBuffer)2 KeyValueEntry (com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.KeyValueEntry)2 ReadArrayBuffer (com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer)1 DataOutput (com.thinkaurelius.titan.graphdb.database.serialize.DataOutput)1 KryoSerializer (com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer)1 RelationType (com.thinkaurelius.titan.graphdb.internal.RelationType)1 UUID (java.util.UUID)1 StopWatch (org.apache.commons.lang.time.StopWatch)1