|
| 1 | +package io.weaviate.client6.v1.api.cluster; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import java.util.List; |
| 5 | +import java.util.Optional; |
| 6 | +import java.util.concurrent.CompletableFuture; |
| 7 | +import java.util.function.Function; |
| 8 | + |
| 9 | +import io.weaviate.client6.v1.internal.ObjectBuilder; |
| 10 | +import io.weaviate.client6.v1.internal.rest.RestTransport; |
| 11 | + |
| 12 | +public class WeaviateClusterClientAsync { |
| 13 | + private final RestTransport restTransport; |
| 14 | + |
| 15 | + public WeaviateClusterClientAsync(RestTransport restTransport) { |
| 16 | + this.restTransport = restTransport; |
| 17 | + } |
| 18 | + |
| 19 | + /** |
| 20 | + * Query sharding state of a collection. |
| 21 | + * |
| 22 | + * @param collection Collection name. |
| 23 | + */ |
| 24 | + public CompletableFuture<Optional<ShardingState>> shardingState(String collection) throws IOException { |
| 25 | + return this.restTransport.performRequestAsync(ListShardsRequest.of(collection), ListShardsRequest._ENDPOINT); |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * Query sharding state of a collection. |
| 30 | + * |
| 31 | + * @param collection Collection name. |
| 32 | + * @param fn Lambda expression for optional parameters. |
| 33 | + */ |
| 34 | + public CompletableFuture<Optional<ShardingState>> shardingState(String collection, |
| 35 | + Function<ListShardsRequest.Builder, ObjectBuilder<ListShardsRequest>> fn) |
| 36 | + throws IOException { |
| 37 | + return this.restTransport.performRequestAsync(ListShardsRequest.of(collection, fn), ListShardsRequest._ENDPOINT); |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Get the status of all nodes in the cluster. |
| 42 | + * |
| 43 | + * @param fn Lambda expression for optional parameters. |
| 44 | + */ |
| 45 | + public CompletableFuture<List<Node>> listNodes() |
| 46 | + throws IOException { |
| 47 | + return this.restTransport.performRequestAsync(ListNodesRequest.of(), ListNodesRequest._ENDPOINT); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Get the status of all nodes in the cluster. |
| 52 | + * |
| 53 | + * @param fn Lambda expression for optional parameters. |
| 54 | + */ |
| 55 | + public CompletableFuture<List<Node>> listNodes(Function<ListNodesRequest.Builder, ObjectBuilder<ListNodesRequest>> fn) |
| 56 | + throws IOException { |
| 57 | + return this.restTransport.performRequestAsync(ListNodesRequest.of(fn), ListNodesRequest._ENDPOINT); |
| 58 | + } |
| 59 | +} |
0 commit comments