Exemple #1
0
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision in async.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</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>HashKV Response</returns>
        public async Task <HashKVResponse> HashKVAsync(HashKVRequest request, Grpc.Core.Metadata headers = null,
                                                       DateTime?deadline = null,
                                                       CancellationToken cancellationToken = default)
        {
            HashKVResponse response   = new HashKVResponse();
            bool           success    = false;
            int            retryCount = 0;

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

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

            return(response);
        }
Exemple #2
0
 /// <summary>
 /// HashKV computes the hash of all MVCC keys up to a given revision.
 /// It only iterates "key" bucket in backend storage.
 /// </summary>
 /// <param name="request">HashKV Request</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>HashKV Response</returns>
 public HashKVResponse HashKV(HashKVRequest request, Grpc.Core.Metadata headers = null,
                              DateTime?deadline = null,
                              CancellationToken cancellationToken = default)
 {
     return(CallEtcd((connection) => connection._maintenanceClient
                     .HashKV(request, headers, deadline, cancellationToken)));
 }
Exemple #3
0
 /// <summary>
 /// HashKV computes the hash of all MVCC keys up to a given revision in async.
 /// It only iterates "key" bucket in backend storage.
 /// </summary>
 /// <param name="request">HashKV Request</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>HashKV Response</returns>
 public async Task <HashKVResponse> HashKVAsync(HashKVRequest request, Grpc.Core.Metadata headers = null,
                                                DateTime?deadline = null,
                                                CancellationToken cancellationToken = default)
 {
     return(await CallEtcdAsync(async (connection) => await connection._maintenanceClient
                                .HashKVAsync(request, headers, deadline, cancellationToken)).ConfigureAwait(false));
 }
Exemple #4
0
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision in async.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</param>
        /// <returns>HashKV Response</returns>
        public async Task <HashKVResponse> HashKVAsync(HashKVRequest request, Metadata headers = null)
        {
            HashKVResponse response   = new HashKVResponse();
            bool           success    = false;
            int            retryCount = 0;

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

                    success = true;
                }
                catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable)
                {
                    retryCount++;
                    if (retryCount >= _balancer._numNodes)
                    {
                        throw ex;
                    }
                }
            }
            return(response);
        }
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision in async.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</param>
        /// <returns>HashKV Response</returns>
        public async Task <HashKVResponse> HashKVAsync(HashKVRequest request, Metadata headers = null)
        {
            HashKVResponse response = new HashKVResponse();

            response = await _balancer.GetConnection().maintenanceClient.HashKVAsync(request, headers);

            return(response);
        }
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</param>
        /// <returns>HashKV Response</returns>
        public HashKVResponse HashKV(HashKVRequest request, Metadata headers = null)
        {
            HashKVResponse response = new HashKVResponse();

            response = _balancer.GetConnection().maintenanceClient.HashKV(request, headers);

            return(response);
        }
Exemple #7
0
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision in async.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</param>
        /// <returns>HashKV Response</returns>
        public async Task <HashKVResponse> HashKVAsync(HashKVRequest request)
        {
            HashKVResponse response = new HashKVResponse();

            try
            {
                response = await _maintenanceClient.HashKVAsync(request);
            }
            catch (RpcException)
            {
                ResetConnection();
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }
Exemple #8
0
        /// <summary>
        /// HashKV computes the hash of all MVCC keys up to a given revision.
        /// It only iterates "key" bucket in backend storage.
        /// </summary>
        /// <param name="request">HashKV Request</param>
        /// <returns>HashKV Response</returns>
        public HashKVResponse HashKV(HashKVRequest request)
        {
            HashKVResponse response = new HashKVResponse();

            try
            {
                response = _maintenanceClient.HashKV(request);
            }
            catch (RpcException)
            {
                ResetConnection();
                throw;
            }
            catch
            {
                throw;
            }
            return(response);
        }