/// <summary> /// Creates an <see cref="IEtcdClient" /> for the specified <see cref="Uri" />. /// </summary> /// <exception cref="ArgumentNullException">Passed <paramref name="uris" /> is null.</exception> /// <exception cref="ArgumentException">The <paramref name="uris" /> is not an absolute <see cref="Uri" />.</exception> public static IEtcdClient ClientFor(params Uri[] uris) { if (uris == null) { throw new ArgumentNullException("uris"); } EndpointPool endpointPool = null; try { endpointPool = EndpointPool.Build() .WithRoutingStrategy(EndpointRoutingStrategy.RoundRobin) .WithVerificationStrategy(EndpointVerificationStrategy.None) .VerifyAndBuild(uris) .Result; } catch (AggregateException ae) { ExceptionDispatchInfo.Capture(ae.Flatten().InnerExceptions.First()).Throw(); } return(ClientFor(endpointPool)); }
public WatchRequest(IEtcdClient etcdClient, EndpointPool endpointPool, bool single, params string[] pathParts) { _etcdClient = etcdClient; EndpointPool = endpointPool; PathParts = pathParts; Single = single; }
/// <summary> /// Creates an <see cref="IEtcdClient" /> for the specified <see cref="EndpointPool" />. /// </summary> /// <exception cref="ArgumentNullException">Passed <paramref name="endpointPool" /> is null.</exception> public static IEtcdClient ClientFor(EndpointPool endpointPool) { if (endpointPool == null) { throw new ArgumentNullException("endpointPool"); } return(new EtcdClient(endpointPool, ClientConfig.Value.DeepCopy())); }
private Task <HttpResponseMessage> CallEndpoint(bool?recursive, long?index) { return(EndpointPool.GetEndpointUrl(PathParts) .SetQueryParam(Constants.Etcd.Parameter_Wait, Constants.Etcd.Parameter_True) .Conditionally(recursive.HasValue && recursive.Value, x => x.SetQueryParam(Constants.Etcd.Parameter_Recursive, Constants.Etcd.Parameter_True)) // ReSharper disable once PossibleInvalidOperationException .Conditionally(index.HasValue, x => x.SetQueryParam(Constants.Etcd.Parameter_WaitIndex, index.Value)) .WithTimeout(Timeout.InfiniteTimeSpan) .GetAsync()); }
public EtcdClient(EndpointPool endpointPool, ClientConfig clientConfig) { EndpointPool = endpointPool; _clientConfig = clientConfig ?? new ClientConfig(); }
public CompareAndSwapRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { }
public DeleteMemberRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { }
public GetLeaderStatisticsRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { }
protected EndpointPool.Builder CreateSut(EndpointVerificationStrategy strategy = null) { return(EndpointPool.Build() .WithVerificationStrategy(strategy ?? VerificationStrategy)); }
public GetVersionRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { }
protected BaseRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) { EtcdClient = etcdClient; _endpointPool = endpointPool; _pathParts = pathParts; }
public DeleteRequest(IEtcdClient etcdClient, EndpointPool endpointPool, bool isDirectory, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { IsDirectory = isDirectory; }
public UpsertQueueRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { }
public CreateMemberRequest(IEtcdClient etcdClient, EndpointPool endpointPool, params string[] pathParts) : base(etcdClient, endpointPool, pathParts) { Uris = new List <Uri>(); }