Search in sources :

Example 36 with DataOutput

use of org.janusgraph.graphdb.database.serialize.DataOutput in project janusgraph by JanusGraph.

the class StandardTransactionIdSerializer method write.

@Override
public void write(WriteBuffer buffer, StandardTransactionId attribute) {
    DataOutput out = (DataOutput) buffer;
    out.writeObjectNotNull(attribute.getInstanceId());
    out.writeObjectNotNull(attribute.getTransactionId());
    out.writeObjectNotNull(attribute.getTransactionTime());
}
Also used : DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput)

Example 37 with DataOutput

use of org.janusgraph.graphdb.database.serialize.DataOutput in project janusgraph by JanusGraph.

the class SerializableSerializer method write.

@Override
public void write(WriteBuffer buffer, T attribute) {
    DataOutput out = (DataOutput) buffer;
    out.writeObjectNotNull(SerializationUtils.serialize(attribute));
}
Also used : DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput)

Example 38 with DataOutput

use of org.janusgraph.graphdb.database.serialize.DataOutput in project janusgraph by JanusGraph.

the class TypeDefinitionDescriptionSerializer method write.

@Override
public void write(WriteBuffer buffer, TypeDefinitionDescription attribute) {
    DataOutput out = (DataOutput) buffer;
    out.writeObjectNotNull(attribute.getCategory());
    out.writeClassAndObject(attribute.getModifier());
}
Also used : DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput)

Example 39 with DataOutput

use of org.janusgraph.graphdb.database.serialize.DataOutput in project janusgraph by JanusGraph.

the class KCVSLog method writeMessage.

private Entry writeMessage(KCVSMessage msg) {
    StaticBuffer content = msg.getContent();
    DataOutput out = manager.serializer.getDataOutput(8 + 8 + manager.senderId.length() + 2 + content.length());
    Instant rawTimestamp = msg.getTimestamp();
    Preconditions.checkArgument(rawTimestamp.isAfter(Instant.EPOCH));
    out.putLong(times.getTime(rawTimestamp));
    out.writeObjectNotNull(manager.senderId);
    out.putLong(numMsgCounter.incrementAndGet());
    final int valuePos = out.getPosition();
    out.putBytes(content);
    return new StaticArrayEntry(out.getStaticBuffer(), valuePos);
}
Also used : DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput) Instant(java.time.Instant) StaticBuffer(org.janusgraph.diskstorage.StaticBuffer) StaticArrayEntry(org.janusgraph.diskstorage.util.StaticArrayEntry)

Aggregations

DataOutput (org.janusgraph.graphdb.database.serialize.DataOutput)39 ReadBuffer (org.janusgraph.diskstorage.ReadBuffer)16 Test (org.junit.jupiter.api.Test)14 StaticBuffer (org.janusgraph.diskstorage.StaticBuffer)10 HashMap (java.util.HashMap)3 Map (java.util.Map)3 StaticArrayEntry (org.janusgraph.diskstorage.util.StaticArrayEntry)3 TClass1Serializer (org.janusgraph.graphdb.serializer.attributes.TClass1Serializer)3 TClass2 (org.janusgraph.graphdb.serializer.attributes.TClass2)3 SpatialContextFactory (org.locationtech.spatial4j.context.SpatialContextFactory)3 EnumMap (java.util.EnumMap)2 PropertyKey (org.janusgraph.core.PropertyKey)2 Geoshape (org.janusgraph.core.attribute.Geoshape)2 DirectionID (org.janusgraph.graphdb.database.idhandling.IDHandler.DirectionID)2 RelationCategory (org.janusgraph.graphdb.internal.RelationCategory)2 TClass1 (org.janusgraph.graphdb.serializer.attributes.TClass1)2 TEnum (org.janusgraph.graphdb.serializer.attributes.TEnum)2 JanusGraphSchemaVertex (org.janusgraph.graphdb.types.vertices.JanusGraphSchemaVertex)2 LoggerFactory (org.slf4j.LoggerFactory)2 LongArrayList (com.carrotsearch.hppc.LongArrayList)1