Skip to content

Commit

Permalink
Minor API improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii0lomakin committed Nov 7, 2023
1 parent 8575801 commit b43a847
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void main(String[] args) {
System.out.printf("%d vectors uploaded in %d ms, building index %n", vectors.length, ts2 - ts1);

ts1 = System.currentTimeMillis();
client.buildIndex(indexName);
client.triggerIndexBuild(indexName);

var stopPrintStatus = new AtomicBoolean();

Expand Down
2 changes: 1 addition & 1 deletion vectoriadb-interface/src/main/proto/IndexManager.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "google/protobuf/empty.proto";

service IndexManager {
rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse) {}
rpc BuildIndex(IndexNameRequest) returns (google.protobuf.Empty) {}
rpc TriggerIndexBuild(IndexNameRequest) returns (google.protobuf.Empty) {}
rpc DropIndex(IndexNameRequest) returns (google.protobuf.Empty) {}
rpc ListIndexes(google.protobuf.Empty) returns (IndexListResponse) {}
rpc RetrieveIndexState(IndexNameRequest) returns (IndexStateResponse) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public IndexMetadata createIndex(final String indexName, final Distance distance
response.getCompressionRatio(), response.getDistanceMultiplier());
}

public void buildIndex(final String indexName) {
public void triggerIndexBuild(final String indexName) {
var builder = IndexManagerOuterClass.IndexNameRequest.newBuilder();
builder.setIndexName(indexName);

var request = builder.build();
//noinspection ResultOfMethodCallIgnored
indexManagerBlockingStub.buildIndex(request);
indexManagerBlockingStub.triggerIndexBuild(request);
}

public void dropIndex(final String indexName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public void createIndex(IndexManagerOuterClass.CreateIndexRequest request,


@Override
public void buildIndex(IndexManagerOuterClass.IndexNameRequest request, StreamObserver<Empty> responseObserver) {
public void triggerIndexBuild(IndexManagerOuterClass.IndexNameRequest request, StreamObserver<Empty> responseObserver) {
operationsSemaphore.acquireUninterruptibly();
try {
if (closed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void testBuildNotExistingIndex() throws Exception {
indexNameRequestBuilder.setIndexName(indexName);

var buildIndexRecorder = StreamRecorder.<Empty>create();
indexManagerService.buildIndex(indexNameRequestBuilder.build(), buildIndexRecorder);
indexManagerService.triggerIndexBuild(indexNameRequestBuilder.build(), buildIndexRecorder);

var completed = buildIndexRecorder.awaitCompletion(1, TimeUnit.MICROSECONDS);
Assert.assertTrue(completed);
Expand Down Expand Up @@ -467,7 +467,7 @@ private static void buildIndex(String indexName, IndexManagerServiceImpl indexMa
indexNameRequestBuilder.setIndexName(indexName);

var buildIndexRecorder = StreamRecorder.<Empty>create();
indexManagerService.buildIndex(indexNameRequestBuilder.build(), buildIndexRecorder);
indexManagerService.triggerIndexBuild(indexNameRequestBuilder.build(), buildIndexRecorder);

checkCompleteness(buildIndexRecorder);
while (true) {
Expand Down

0 comments on commit b43a847

Please sign in to comment.