use of com.baidu.hugegraph.computer.core.store.entry.EntryOutput in project hugegraph-computer by hugegraph.
the class EdgesInputTest method writeVertex.
private static byte[] writeVertex(Vertex vertex) throws IOException {
BytesOutput bytesOutput = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
EntryOutput entryOutput = new EntryOutputImpl(bytesOutput);
GraphComputeOutput output = new StreamGraphOutput(context(), entryOutput);
output.writeVertex(vertex);
return bytesOutput.toByteArray();
}
use of com.baidu.hugegraph.computer.core.store.entry.EntryOutput in project hugegraph-computer by hugegraph.
the class ComputeManagerTest method writeVertex.
private static byte[] writeVertex(Vertex vertex) throws IOException {
BytesOutput bytesOutput = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
EntryOutput entryOutput = new EntryOutputImpl(bytesOutput);
GraphComputeOutput output = new StreamGraphOutput(context(), entryOutput);
output.writeVertex(vertex);
return bytesOutput.toByteArray();
}
use of com.baidu.hugegraph.computer.core.store.entry.EntryOutput in project hugegraph-computer by hugegraph.
the class ReceiverUtil method writeMessage.
public static byte[] writeMessage(Id id, Writable message) throws IOException {
BytesOutput bytesOutput = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
EntryOutput entryOutput = new EntryOutputImpl(bytesOutput);
entryOutput.writeEntry(out -> {
id.write(out);
}, message);
return bytesOutput.toByteArray();
}
use of com.baidu.hugegraph.computer.core.store.entry.EntryOutput in project hugegraph-computer by hugegraph.
the class EdgeMessageRecvPartitionTest method writeEdges.
private static byte[] writeEdges(Vertex vertex) throws IOException {
BytesOutput bytesOutput = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
EntryOutput entryOutput = new EntryOutputImpl(bytesOutput);
Id id = vertex.id();
KvEntryWriter subKvWriter = entryOutput.writeEntry(out -> {
id.write(out);
});
for (Edge edge : vertex.edges()) {
Id targetId = edge.targetId();
subKvWriter.writeSubKv(out -> {
targetId.write(out);
}, out -> {
edge.properties().write(out);
});
}
subKvWriter.writeFinish();
return bytesOutput.toByteArray();
}
use of com.baidu.hugegraph.computer.core.store.entry.EntryOutput in project hugegraph-computer by hugegraph.
the class VertexMessageRecvPartitionTest method writeVertex.
private static byte[] writeVertex(Vertex vertex) throws IOException {
BytesOutput bytesOutput = IOFactory.createBytesOutput(Constants.SMALL_BUF_SIZE);
EntryOutput entryOutput = new EntryOutputImpl(bytesOutput);
entryOutput.writeEntry(out -> {
vertex.id().write(out);
}, out -> {
out.writeUTF(vertex.label());
vertex.properties().write(out);
});
return bytesOutput.toByteArray();
}
Aggregations