Search in sources :

Example 1 with GetTailOffsetsRequest

use of com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest 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 GetTailOffsetsRequest

use of com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest 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)

Aggregations

GetTailOffsetsRequest (com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest)2 GetTailOffsetsResponse (com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse)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