use of com.alibaba.maxgraph.proto.groot.WriteIngestorRequest in project GraphScope by alibaba.
the class IngestorWriteClient method writeIngestorAsync.
public void writeIngestorAsync(String requestId, int queueId, OperationBatch operationBatch, CompletionCallback<Long> callback) {
WriteIngestorRequest request = WriteIngestorRequest.newBuilder().setRequestId(requestId).setQueueId(queueId).setOperationBatch(operationBatch.toProto()).build();
this.asyncStub.writeIngestor(request, new StreamObserver<WriteIngestorResponse>() {
@Override
public void onNext(WriteIngestorResponse response) {
callback.onCompleted(response.getSnapshotId());
}
@Override
public void onError(Throwable t) {
callback.onError(t);
}
@Override
public void onCompleted() {
}
});
}
use of com.alibaba.maxgraph.proto.groot.WriteIngestorRequest in project GraphScope by alibaba.
the class IngestorRpcTest method testIngestorWriteService.
@Test
void testIngestorWriteService() {
IngestService ingestService = mock(IngestService.class);
IngestorWriteService ingestorWriteService = new IngestorWriteService(ingestService);
WriteIngestorRequest req = WriteIngestorRequest.newBuilder().setQueueId(2).setRequestId("test_req").setOperationBatch(OperationBatch.newBuilder().build().toProto()).build();
doAnswer(invocation -> {
IngestCallback callback = invocation.getArgument(3);
callback.onSuccess(10L);
return null;
}).when(ingestService).ingestBatch(eq("test_req"), eq(2), eq(OperationBatch.newBuilder().build()), any());
StreamObserver<WriteIngestorResponse> observer = mock(StreamObserver.class);
ingestorWriteService.writeIngestor(req, observer);
verify(observer).onNext(WriteIngestorResponse.newBuilder().setSnapshotId(10L).build());
verify(observer).onCompleted();
}
use of com.alibaba.maxgraph.proto.groot.WriteIngestorRequest in project GraphScope by alibaba.
the class IngestorWriteClient method writeIngestor.
public BatchId writeIngestor(String requestId, int queueId, OperationBatch operationBatch) {
WriteIngestorRequest request = WriteIngestorRequest.newBuilder().setRequestId(requestId).setQueueId(queueId).setOperationBatch(operationBatch.toProto()).build();
WriteIngestorResponse response = this.stub.writeIngestor(request);
return new BatchId(response.getSnapshotId());
}
Aggregations