use of com.alibaba.maxgraph.proto.groot.WriteStoreRequest.Builder in project GraphScope by alibaba.
the class StoreWriteClient method writeStore.
public void writeStore(List<StoreDataBatch> storeDataBatches, CompletionCallback<Integer> callback) {
Builder builder = WriteStoreRequest.newBuilder();
for (StoreDataBatch storeDataBatch : storeDataBatches) {
builder.addDataBatches(storeDataBatch.toProto());
}
WriteStoreRequest req = builder.build();
stub.writeStore(req, new StreamObserver<WriteStoreResponse>() {
@Override
public void onNext(WriteStoreResponse writeStoreResponse) {
boolean success = writeStoreResponse.getSuccess();
if (success) {
callback.onCompleted(req.getSerializedSize());
} else {
onError(new RuntimeException("store buffer is full"));
}
}
@Override
public void onError(Throwable throwable) {
callback.onError(throwable);
}
@Override
public void onCompleted() {
}
});
}
Aggregations