|
1 | 1 | using System.Runtime.InteropServices; |
2 | 2 | using Google.Protobuf.Collections; |
| 3 | +using Grpc.Core; |
3 | 4 | using Microsoft.Extensions.Logging; |
4 | 5 | using Microsoft.Extensions.Logging.Abstractions; |
5 | 6 | using Qdrant.Client.Grpc; |
@@ -93,7 +94,6 @@ private QdrantClient( |
93 | 94 | _collectionsClient = grpcClient.Collections; |
94 | 95 | _pointsClient = grpcClient.Points; |
95 | 96 | _snapshotsClient = grpcClient.Snapshots; |
96 | | - |
97 | 97 | _grpcTimeout = grpcTimeout; |
98 | 98 | _logger = loggerFactory?.CreateLogger("Qdrant.Client") ?? NullLogger.Instance; |
99 | 99 | } |
@@ -4288,6 +4288,21 @@ public async Task<DeleteShardKeyResponse> DeleteShardKeyAsync( |
4288 | 4288 |
|
4289 | 4289 | #endregion Cluster management |
4290 | 4290 |
|
| 4291 | + /// <summary> |
| 4292 | + /// Asynchronously checks the health of the Qdrant service. |
| 4293 | + /// </summary> |
| 4294 | + /// The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />. |
| 4295 | + /// <returns> |
| 4296 | + /// A task that represents the asynchronous operation. The task result contains |
| 4297 | + /// a <see cref="HealthCheckReply"/> indicating the health status of the Qdrant service. |
| 4298 | + /// </returns> |
| 4299 | + /// <exception cref="RpcException">occurs when server is unavailable</exception> |
| 4300 | + public async Task<HealthCheckReply> HealthAsync(CancellationToken cancellationToken = default) => |
| 4301 | + await _grpcClient.Qdrant.HealthCheckAsync( |
| 4302 | + new HealthCheckRequest(), |
| 4303 | + deadline: _grpcTimeout == default ? null : DateTime.UtcNow.Add(_grpcTimeout), |
| 4304 | + cancellationToken: cancellationToken).ConfigureAwait(false); |
| 4305 | + |
4291 | 4306 | private static void Populate<T>(RepeatedField<T> repeatedField, ReadOnlyMemory<T> memory) |
4292 | 4307 | { |
4293 | 4308 | if (MemoryMarshal.TryGetArray(memory, out var segment) && |
|
0 commit comments