|
32 | 32 | import io.qdrant.client.grpc.Collections.ListCollectionAliasesRequest; |
33 | 33 | import io.qdrant.client.grpc.Collections.ListCollectionsRequest; |
34 | 34 | import io.qdrant.client.grpc.Collections.ListCollectionsResponse; |
| 35 | +import io.qdrant.client.grpc.Collections.ListShardKeysRequest; |
| 36 | +import io.qdrant.client.grpc.Collections.ListShardKeysResponse; |
35 | 37 | import io.qdrant.client.grpc.Collections.PayloadIndexParams; |
36 | 38 | import io.qdrant.client.grpc.Collections.PayloadSchemaType; |
37 | 39 | import io.qdrant.client.grpc.Collections.RenameAlias; |
38 | 40 | import io.qdrant.client.grpc.Collections.ShardKey; |
| 41 | +import io.qdrant.client.grpc.Collections.ShardKeyDescription; |
39 | 42 | import io.qdrant.client.grpc.Collections.UpdateCollection; |
40 | 43 | import io.qdrant.client.grpc.Collections.UpdateCollectionClusterSetupRequest; |
41 | 44 | import io.qdrant.client.grpc.Collections.UpdateCollectionClusterSetupResponse; |
@@ -926,6 +929,37 @@ public ListenableFuture<DeleteShardKeyResponse> deleteShardKeyAsync( |
926 | 929 | MoreExecutors.directExecutor()); |
927 | 930 | } |
928 | 931 |
|
| 932 | + /** |
| 933 | + * List the shard keys of a collection. |
| 934 | + * |
| 935 | + * @param collectionName The name of the collection to list shard keys for. |
| 936 | + * @return a new instance of {@link ListenableFuture} |
| 937 | + */ |
| 938 | + public ListenableFuture<List<ShardKeyDescription>> listShardKeysAsync(String collectionName) { |
| 939 | + return listShardKeysAsync(collectionName, null); |
| 940 | + } |
| 941 | + |
| 942 | + /** |
| 943 | + * List the shard keys of a collection. |
| 944 | + * |
| 945 | + * @param collectionName The name of the collection to list shard keys for. |
| 946 | + * @param timeout The timeout for the call. |
| 947 | + * @return a new instance of {@link ListenableFuture} |
| 948 | + */ |
| 949 | + public ListenableFuture<List<ShardKeyDescription>> listShardKeysAsync( |
| 950 | + String collectionName, @Nullable Duration timeout) { |
| 951 | + Preconditions.checkArgument(!collectionName.isEmpty(), "Collection name must not be empty"); |
| 952 | + logger.debug("List shard keys for '{}'", collectionName); |
| 953 | + |
| 954 | + ListenableFuture<ListShardKeysResponse> future = |
| 955 | + getCollections(timeout) |
| 956 | + .listShardKeys( |
| 957 | + ListShardKeysRequest.newBuilder().setCollectionName(collectionName).build()); |
| 958 | + addLogFailureCallback(future, "List Shard Keys"); |
| 959 | + return Futures.transform( |
| 960 | + future, response -> response.getShardKeysList(), MoreExecutors.directExecutor()); |
| 961 | + } |
| 962 | + |
929 | 963 | // endregion |
930 | 964 |
|
931 | 965 | // region Point Management |
|
0 commit comments