Search in sources :

Example 1 with GetTailOffsetsResponse

use of com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse in project GraphScope by alibaba.

the class IngestProgressClient method getTailOffsets.

public List<Long> getTailOffsets(List<Integer> queueIds) {
    GetTailOffsetsRequest req = GetTailOffsetsRequest.newBuilder().addAllQueueId(queueIds).build();
    GetTailOffsetsResponse tailOffsetsResponse = stub.getTailOffsets(req);
    return tailOffsetsResponse.getOffsetsList();
}
Also used : GetTailOffsetsRequest(com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest) GetTailOffsetsResponse(com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse)

Example 2 with GetTailOffsetsResponse

use of com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse in project GraphScope by alibaba.

the class IngestProgressServiceTest method testIngestProgressService.

@Test
void testIngestProgressService() {
    SnapshotManager snapshotManager = mock(SnapshotManager.class);
    when(snapshotManager.getTailOffsets(Arrays.asList(1))).thenReturn(Arrays.asList(10L));
    IngestProgressService ingestProgressService = new IngestProgressService(snapshotManager);
    GetTailOffsetsRequest request = GetTailOffsetsRequest.newBuilder().addQueueId(1).build();
    ingestProgressService.getTailOffsets(request, new StreamObserver<GetTailOffsetsResponse>() {

        @Override
        public void onNext(GetTailOffsetsResponse response) {
            List<Long> offsetsList = response.getOffsetsList();
            assertEquals(offsetsList.size(), 1);
            assertEquals(offsetsList.get(0), 10L);
        }

        @Override
        public void onError(Throwable t) {
            throw new RuntimeException(t);
        }

        @Override
        public void onCompleted() {
        }
    });
    verify(snapshotManager).getTailOffsets(Arrays.asList(1));
}
Also used : List(java.util.List) GetTailOffsetsRequest(com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest) GetTailOffsetsResponse(com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse) SnapshotManager(com.alibaba.graphscope.groot.coordinator.SnapshotManager) IngestProgressService(com.alibaba.graphscope.groot.coordinator.IngestProgressService) Test(org.junit.jupiter.api.Test)

Example 3 with GetTailOffsetsResponse

use of com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse in project GraphScope by alibaba.

the class IngestProgressService method getTailOffsets.

@Override
public void getTailOffsets(GetTailOffsetsRequest request, StreamObserver<GetTailOffsetsResponse> responseObserver) {
    logger.info("Get offset of [" + request.getQueueIdList() + "]");
    List<Integer> queueIdList = request.getQueueIdList();
    List<Long> tailOffsets = this.snapshotManager.getTailOffsets(queueIdList);
    GetTailOffsetsResponse response = GetTailOffsetsResponse.newBuilder().addAllOffsets(tailOffsets).build();
    responseObserver.onNext(response);
    responseObserver.onCompleted();
}
Also used : GetTailOffsetsResponse(com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse)

Aggregations

GetTailOffsetsResponse (com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse)3 GetTailOffsetsRequest (com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest)2 IngestProgressService (com.alibaba.graphscope.groot.coordinator.IngestProgressService)1 SnapshotManager (com.alibaba.graphscope.groot.coordinator.SnapshotManager)1 List (java.util.List)1 Test (org.junit.jupiter.api.Test)1