Search in sources :

Example 6 with WriteBuffer

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

Example 7 with WriteBuffer

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

Example 8 with WriteBuffer

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

Example 9 with WriteBuffer

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)));
    }
}
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 10 with WriteBuffer

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

Aggregations

WriteBuffer (com.thinkaurelius.titan.diskstorage.WriteBuffer)10 WriteByteBuffer (com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer)10 ReadBuffer (com.thinkaurelius.titan.diskstorage.ReadBuffer)4 Test (org.junit.Test)3 StaticBuffer (com.thinkaurelius.titan.diskstorage.StaticBuffer)2 IDHandler (com.thinkaurelius.titan.graphdb.database.idhandling.IDHandler)1 DataOutput (com.thinkaurelius.titan.graphdb.database.serialize.DataOutput)1 Serializer (com.thinkaurelius.titan.graphdb.database.serialize.Serializer)1 StandardSerializer (com.thinkaurelius.titan.graphdb.database.serialize.StandardSerializer)1 RelationCategory (com.thinkaurelius.titan.graphdb.internal.RelationCategory)1 StopWatch (org.apache.commons.lang.time.StopWatch)1