예제 #1
0
파일: KVClient.cs 프로젝트: endless001/etcd
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store in async. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request">The request to send to the server.</param>
 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
 /// <param name="cancellationToken">An optional token for canceling the call.</param>
 /// <returns>The response received from the server.</returns>
 public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Grpc.Core.Metadata headers = null,
                                                     DateTime?deadline = null,
                                                     CancellationToken cancellationToken = default)
 {
     return(await CallEtcdAsync(async (connection) => await connection.kvClient
                                .CompactAsync(request, headers, deadline, cancellationToken)));
 }
예제 #2
0
파일: KVClient.cs 프로젝트: endless001/etcd
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request">The request to send to the server.</param>
 /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
 /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
 /// <param name="cancellationToken">An optional token for canceling the call.</param>
 /// <returns>The response received from the server.</returns>
 public CompactionResponse Compact(CompactionRequest request, Grpc.Core.Metadata headers = null,
                                   DateTime?deadline = null,
                                   CancellationToken cancellationToken = default)
 {
     return(CallEtcd((connection) => connection.kvClient
                     .Compact(request, headers, deadline, cancellationToken)));
 }
예제 #3
0
        /// <summary>
        /// Compact compacts the event history in the etcd key-value store in async. The key-value
        /// store should be periodically compacted or the event history will continue to grow
        /// indefinitely.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Metadata headers = null)
        {
            CompactionResponse response = new CompactionResponse();
            bool success    = false;
            int  retryCount = 0;

            while (!success)
            {
                try
                {
                    response = await _balancer.GetConnection().kvClient.CompactAsync(request, headers);

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
예제 #4
0
        /// <summary>
        /// Compact compacts the event history in the etcd key-value store in async. The key-value
        /// store should be periodically compacted or the event history will continue to grow
        /// indefinitely.
        /// </summary>
        /// <param name="request">The request to send to the server.</param>
        /// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
        /// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
        /// <param name="cancellationToken">An optional token for canceling the call.</param>
        /// <returns>The response received from the server.</returns>
        public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Grpc.Core.Metadata headers = null,
                                                            DateTime?deadline = null,
                                                            CancellationToken cancellationToken = default)
        {
            CompactionResponse response = new CompactionResponse();
            bool success    = false;
            int  retryCount = 0;

            while (!success)
            {
                try
                {
                    response = await _balancer.GetConnection().kvClient
                               .CompactAsync(request, headers, deadline, cancellationToken);

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw;
                    }
                }
            }

            return(response);
        }
예제 #5
0
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store in async. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <CompactionResponse> CompactAsync(CompactionRequest request)
 {
     try
     {
         return(await _kvClient.CompactAsync(request, _headers));
     }
     catch (RpcException)
     {
         ResetConnection();
         throw;
     }
     catch
     {
         throw;
     }
 }
예제 #6
0
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public CompactionResponse Compact(CompactionRequest request)
 {
     try
     {
         return(_kvClient.Compact(request, _headers));
     }
     catch (RpcException)
     {
         ResetConnection();
         throw;
     }
     catch
     {
         throw;
     }
 }
예제 #7
0
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store in async. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public async Task <CompactionResponse> CompactAsync(CompactionRequest request, Metadata headers = null)
 {
     return(await _balancer.GetConnection().kvClient.CompactAsync(request, headers));
 }
예제 #8
0
 /// <summary>
 /// Compact compacts the event history in the etcd key-value store. The key-value
 /// store should be periodically compacted or the event history will continue to grow
 /// indefinitely.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public CompactionResponse Compact(CompactionRequest request, Metadata headers = null)
 {
     return(_balancer.GetConnection().kvClient.Compact(request, headers));
 }