コード例 #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>
        /// <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);
        }
コード例 #2
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);
        }
コード例 #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>
        /// <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);
        }
コード例 #4
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, Metadata headers = null)
        {
            HashKVResponse response = new HashKVResponse();

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

            return(response);
        }
コード例 #5
0
        public HashKVResponse HashKV(Uri endpoint, long rev)
        {
            //新连接
            Etcdserverpb.HashKVRequest request = new Etcdserverpb.HashKVRequest();
            request.Revision = rev;
            var            rsp      = maintenanceClient.HashKV(request);
            HashKVResponse response = new HashKVResponse(rsp);

            return(response);
            // return Util.ToCompletableFuture(
            //            stub.HashKV(request),
            //            new FunctionResponse<Etcdserverpb.HashKVRequest, HashKVResponse>()
            //);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }