use of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput in project titan by thinkaurelius.
the class ManagementLogger method sendCacheEviction.
public void sendCacheEviction(Set<TitanSchemaVertex> updatedTypes, Set<Callable<Boolean>> updatedTypeTriggers, Set<String> openInstances) {
Preconditions.checkArgument(!openInstances.isEmpty());
long evictionId = evictionTriggerCounter.incrementAndGet();
evictionTriggerMap.put(evictionId, new EvictionTrigger(evictionId, updatedTypeTriggers, openInstances));
DataOutput out = graph.getDataSerializer().getDataOutput(128);
out.writeObjectNotNull(MgmtLogType.CACHED_TYPE_EVICTION);
VariableLong.writePositive(out, evictionId);
VariableLong.writePositive(out, updatedTypes.size());
for (TitanSchemaVertex type : updatedTypes) {
assert type.hasId();
VariableLong.writePositive(out, type.longId());
}
sysLog.add(out.getStaticBuffer());
}
use of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput in project titan by thinkaurelius.
the class ParameterSerializer method write.
@Override
public void write(WriteBuffer buffer, Parameter attribute) {
DataOutput out = (DataOutput) buffer;
out.writeObjectNotNull(attribute.key());
out.writeClassAndObject(attribute.value());
}
use of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput in project titan by thinkaurelius.
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());
}
use of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput in project titan by thinkaurelius.
the class IndexSerializer method getIndexKey.
private final StaticBuffer getIndexKey(CompositeIndexType index, Object[] values) {
DataOutput out = serializer.getDataOutput(8 * DEFAULT_OBJECT_BYTELEN + 8);
VariableLong.writePositive(out, index.getID());
IndexField[] fields = index.getFieldKeys();
Preconditions.checkArgument(fields.length > 0 && fields.length == values.length);
for (int i = 0; i < fields.length; i++) {
IndexField f = fields[i];
Object value = values[i];
Preconditions.checkNotNull(value);
if (AttributeUtil.hasGenericDataType(f.getFieldKey())) {
out.writeClassAndObject(value);
} else {
assert value.getClass().equals(f.getFieldKey().dataType()) : value.getClass() + " - " + f.getFieldKey().dataType();
out.writeObjectNotNull(value);
}
}
StaticBuffer key = out.getStaticBuffer();
if (hashKeys)
key = HashingUtil.hashPrefixKey(hashLength, key);
return key;
}
use of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput in project titan by thinkaurelius.
the class IndexSerializer method getIndexEntry.
private final Entry getIndexEntry(CompositeIndexType index, RecordEntry[] record, TitanElement element) {
DataOutput out = serializer.getDataOutput(1 + 8 + 8 * record.length + 4 * 8);
out.putByte(FIRST_INDEX_COLUMN_BYTE);
if (index.getCardinality() != Cardinality.SINGLE) {
VariableLong.writePositive(out, element.longId());
if (index.getCardinality() != Cardinality.SET) {
for (RecordEntry re : record) {
VariableLong.writePositive(out, re.relationId);
}
}
}
int valuePosition = out.getPosition();
if (element instanceof TitanVertex) {
VariableLong.writePositive(out, element.longId());
} else {
assert element instanceof TitanRelation;
RelationIdentifier rid = (RelationIdentifier) element.id();
long[] longs = rid.getLongRepresentation();
Preconditions.checkArgument(longs.length == 3 || longs.length == 4);
for (int i = 0; i < longs.length; i++) VariableLong.writePositive(out, longs[i]);
}
return new StaticArrayEntry(out.getStaticBuffer(), valuePosition);
}
Aggregations