Skip to content

Commit

Permalink
chore: review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 committed Dec 21, 2023
1 parent a3709e7 commit a7da5ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,4 @@ publishing {
repositories {
mavenLocal()
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ qdrantProtosVersion=v1.7.0
qdrantVersion=v1.7.0

# The version of the client to generate
packageVersion=1.7-SNAPSHOT
packageVersion=1.7.0
7 changes: 5 additions & 2 deletions src/main/java/io/qdrant/client/QdrantClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import static io.qdrant.client.grpc.Collections.PayloadIndexParams;
import static io.qdrant.client.grpc.Collections.PayloadSchemaType;
import static io.qdrant.client.grpc.Collections.RenameAlias;
import static io.qdrant.client.grpc.Collections.ShardKey;
import static io.qdrant.client.grpc.Collections.UpdateCollection;
import static io.qdrant.client.grpc.Collections.VectorParams;
import static io.qdrant.client.grpc.Collections.VectorParamsMap;
Expand Down Expand Up @@ -696,14 +697,15 @@ public ListenableFuture<CreateShardKeyResponse> createShardKeyAsync(CreateShardK
public ListenableFuture<CreateShardKeyResponse> createShardKeyAsync(CreateShardKeyRequest createShardKey, @Nullable Duration timeout) {
String collectionName = createShardKey.getCollectionName();
Preconditions.checkArgument(!collectionName.isEmpty(), "Collection name must not be empty");
ShardKey shardKey = createShardKey.getRequest().getShardKey();
logger.debug("Create shard key '{}' for '{}'", shardKey, collectionName);

ListenableFuture<CreateShardKeyResponse> future = getCollections(timeout).createShardKey(createShardKey);
addLogFailureCallback(future, "Create shard key");
return Futures.transform(future, response -> {
if (!response.getResult()) {
logger.error("Shard key could not be created for '{}'", collectionName);
throw new QdrantException("Shard key could not be created for '" + collectionName);
throw new QdrantException("Shard key " + shardKey + " could not be created for " + collectionName);
}
return response;
}, MoreExecutors.directExecutor());
Expand All @@ -729,14 +731,15 @@ public ListenableFuture<DeleteShardKeyResponse> deleteShardKeyAsync(DeleteShardK
public ListenableFuture<DeleteShardKeyResponse> deleteShardKeyAsync(DeleteShardKeyRequest deleteShardKey, @Nullable Duration timeout) {
String collectionName = deleteShardKey.getCollectionName();
Preconditions.checkArgument(!collectionName.isEmpty(), "Collection name must not be empty");
ShardKey shardKey = deleteShardKey.getRequest().getShardKey();
logger.debug("Delete shard key '{}' for '{}'", shardKey, collectionName);

ListenableFuture<DeleteShardKeyResponse> future = getCollections(timeout).deleteShardKey(deleteShardKey);
addLogFailureCallback(future, "Delete shard key");
return Futures.transform(future, response -> {
if (!response.getResult()) {
logger.error("Shard key '{}' could not be deleted for '{}'", shardKey, collectionName);
throw new QdrantException("Shard key could not be deleted for '" + collectionName);
throw new QdrantException("Shard key " + shardKey + " could not be created for " + collectionName);
}
return response;
}, MoreExecutors.directExecutor());
Expand Down

0 comments on commit a7da5ed

Please sign in to comment.