Skip to content

Commit

Permalink
[feat][sdk] Support vector count.
Browse files Browse the repository at this point in the history
  • Loading branch information
wt0530 authored and rock-git committed Sep 27, 2023
1 parent 4f2baba commit 5143f05
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ public List<Boolean> vectorDelete(DingoCommonId indexId, DingoCommonId regionId,
return response.getKeyStatesList();
}

public Long vectorCount(DingoCommonId indexId, DingoCommonId regionId) {
Index.VectorCountRequest.Builder builder = Index.VectorCountRequest.newBuilder();

Index.VectorCountResponse response = exec(stub -> stub.vectorCount(
builder.setContext(mapping(contextCache.get(regionId))).build()), retryTimes, indexId, regionId);

return response.getCount();
}

private <R> R exec(
Function<IndexServiceGrpc.IndexServiceBlockingStub, R> function,
int retryTimes,
Expand Down

0 comments on commit 5143f05

Please sign in to comment.