use of com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdResponse in project GraphScope by alibaba.
the class IngestorSnapshotClient method advanceIngestSnapshotId.
public void advanceIngestSnapshotId(long writeSnapshotId, CompletionCallback<Long> callback) {
AdvanceIngestSnapshotIdRequest req = AdvanceIngestSnapshotIdRequest.newBuilder().setSnapshotId(writeSnapshotId).build();
stub.advanceIngestSnapshotId(req, new StreamObserver<AdvanceIngestSnapshotIdResponse>() {
@Override
public void onNext(AdvanceIngestSnapshotIdResponse response) {
long previousSnapshotId = response.getPreviousSnapshotId();
callback.onCompleted(previousSnapshotId);
}
@Override
public void onError(Throwable throwable) {
callback.onError(throwable);
}
@Override
public void onCompleted() {
}
});
}
use of com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdResponse in project GraphScope by alibaba.
the class IngestorRpcTest method testIngestorSnapshotService.
@Test
void testIngestorSnapshotService() {
IngestService ingestService = mock(IngestService.class);
IngestorSnapshotService ingestorSnapshotService = new IngestorSnapshotService(ingestService);
AdvanceIngestSnapshotIdRequest req = AdvanceIngestSnapshotIdRequest.newBuilder().setSnapshotId(10L).build();
StreamObserver<AdvanceIngestSnapshotIdResponse> streamObserver = mock(StreamObserver.class);
doAnswer(invocation -> {
CompletionCallback<Long> callback = invocation.getArgument(1);
callback.onCompleted(9L);
return null;
}).when(ingestService).advanceIngestSnapshotId(anyLong(), any());
ingestorSnapshotService.advanceIngestSnapshotId(req, streamObserver);
verify(streamObserver).onNext(AdvanceIngestSnapshotIdResponse.newBuilder().setPreviousSnapshotId(9L).build());
verify(streamObserver).onCompleted();
}
Aggregations