/// <summary> /// MemberAddAsync adds a member into the cluster in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <MemberAddResponse> MemberAddAsync(MemberAddRequest request, Grpc.Core.Metadata headers = null) { MemberAddResponse response = new MemberAddResponse(); bool success = false; int retryCount = 0; while (!success) { try { response = await _balancer.GetConnection().clusterClient.MemberAddAsync(request, headers); success = true; } catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable) { retryCount++; if (retryCount >= _balancer._numNodes) { throw ex; } } } return(response); }
/// <summary> /// MemberAdd adds a member into the cluster /// </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 MemberAddResponse MemberAdd(MemberAddRequest request, Grpc.Core.Metadata headers = null, DateTime?deadline = null, CancellationToken cancellationToken = default) { MemberAddResponse response = new MemberAddResponse(); bool success = false; int retryCount = 0; while (!success) { try { response = _balancer.GetConnection().clusterClient .MemberAdd(request, headers, deadline, cancellationToken); success = true; } catch (RpcException ex) when(ex.StatusCode == StatusCode.Unavailable) { retryCount++; if (retryCount >= _balancer._numNodes) { throw; } } } return(response); }
/// <summary> /// MemberAddAsync adds a member into the cluster in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <MemberAddResponse> MemberAddAsync(MemberAddRequest request, Metadata headers = null) { MemberAddResponse response = new MemberAddResponse(); response = await _balancer.GetConnection().clusterClient.MemberAddAsync(request, headers); return(response); }
/// <summary> /// MemberAdd adds a member into the cluster /// </summary> /// <param name="request"></param> /// <returns></returns> public MemberAddResponse MemberAdd(MemberAddRequest request, Metadata headers = null) { MemberAddResponse response = new MemberAddResponse(); response = _balancer.GetConnection().clusterClient.MemberAdd(request, headers); return(response); }
public static Entity.MemberAddResponse FromProto(this MemberAddResponse response) { var tmp = new Entity.MemberAddResponse() { Header = response.Header.FromProto(), Member = response.Member.FromProto(), Members = response.Members.FromProto() }; return(tmp); }
/** * add a new member into the cluster. * * @param peerAddrs the peer addresses of the new member */ public MemberAddResponse AddMember(List <Uri> peerAddrs) { Etcdserverpb.MemberAddRequest memberAddRequest = new Etcdserverpb.MemberAddRequest(); foreach (Uri uri in peerAddrs) { memberAddRequest.PeerURLs.Add(uri.Host); } var rsp = clusterClient.MemberAdd(memberAddRequest); MemberAddResponse response = new MemberAddResponse(rsp); return(response); // return Util.ToCompletableFuture( // memberAddRequest, new FunctionResponse<Etcdserverpb.MemberAddRequest, MemberAddResponse>() // ); }
/// <summary> /// MemberAddAsync adds a member into the cluster in async /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <MemberAddResponse> MemberAddAsync(MemberAddRequest request) { MemberAddResponse response = new MemberAddResponse(); try { response = await _clusterClient.MemberAddAsync(request, _headers); } catch (RpcException ex) { ResetConnection(ex); throw; } catch { throw; } return(response); }
/// <summary> /// MemberAdd adds a member into the cluster /// </summary> /// <param name="request"></param> /// <returns></returns> public MemberAddResponse MemberAdd(MemberAddRequest request) { MemberAddResponse response = new MemberAddResponse(); try { response = _clusterClient.MemberAdd(request, _headers); } catch (RpcException ex) { ResetConnection(ex); throw; } catch { throw; } return(response); }