Package io.etcd.jetcd
Class ClientBuilder
java.lang.Object
io.etcd.jetcd.ClientBuilder
- All Implemented Interfaces:
Cloneable
ClientBuilder knows how to create a Client instance.
-
Method Summary
Modifier and TypeMethodDescriptionauthHeader(String key, String value) Add an auth header.Returns the headers to be added to auth request headersauthHeaders(Map<io.grpc.Metadata.Key<?>, Object> authHeaders) Set the auth headers.List<io.grpc.ClientInterceptor>Returns the auth interceptorsauthInterceptors(io.grpc.ClientInterceptor interceptor, io.grpc.ClientInterceptor... interceptors) Add an auth interceptor.authInterceptors(List<io.grpc.ClientInterceptor> interceptors) Set the auth interceptors.Returns The authority used to authenticate connections to servers.Sets the authority used to authenticate connections to servers.build()build a new Client.Returns the connect timeout.connectTimeout(Duration connectTimeout) Set the connection timeout.copy()Returns a copy of this builderconfigure etcd server endpoints using theIPNameResolver.configure etcd server endpoints using theIPNameResolver.configure etcd server endpoints using theIPNameResolver.Returns the executor serviceexecutorService(ExecutorService executorService) config executor service.Set headers.headers()Returns the headers to be added to http request headersSets headers to be added to http request headers.interceptor(io.grpc.ClientInterceptor interceptor, io.grpc.ClientInterceptor... interceptors) Add an interceptor.List<io.grpc.ClientInterceptor>Returns the interceptorsinterceptors(List<io.grpc.ClientInterceptor> interceptors) Set the interceptors.Returns the keep alive time.keepaliveTime(Duration keepaliveTime) The interval for gRPC keepalives.Returns the keep alive time out.keepaliveTimeout(Duration keepaliveTimeout) The timeout for gRPC keepaliveskeepaliveWithoutCalls(Boolean keepaliveWithoutCalls) Keepalive option for gRPCget the load balancer policy for etcd client.loadBalancerPolicy(String loadBalancerPolicy) config load balancer policy.Returns the maximum message size allowed for a single gRPC frame.maxInboundMessageSize(Integer maxInboundMessageSize) Sets the maximum message size allowed for a single gRPC frame.Returns the namespace of each key usednamespace(ByteSequence namespace) config the namespace of keys used inKV,Txn,LockandWatch.password()Returns the auth passwordpassword(ByteSequence password) config etcd auth password.Returns he retries period unit.retryChronoUnit(ChronoUnit retryChronoUnit) Sets the retries period unit.longReturns The delay between retries.retryDelay(long retryDelay) The delay between retries.intReturns the max number of retry attemptsretryMaxAttempts(int retryMaxAttempts) Set the max number of retry attemptslongReturns the max backing off delay between retriesretryMaxDelay(long retryMaxDelay) Set the max backing off delay between retries.Returns the retries max duration.retryMaxDuration(Duration retryMaxDuration) Set the retries max duration.io.netty.handler.ssl.SslContextReturns the ssl contextsslContext(io.netty.handler.ssl.SslContext sslContext) SSL/TLS context to use instead of the system default.sslContext(Consumer<io.netty.handler.ssl.SslContextBuilder> consumer) Configure SSL/TLS context create throughGrpcSslContexts.forClient()to use.target()Gets the etcd target.configure etcd server endpoints.user()Returns the auth useruser(ByteSequence user) config etcd auth user.booleanEnable gRPC's wait for ready semantics.waitForReady(boolean waitForReady) Configure the gRPC's wait for ready semantics.
-
Method Details
-
target
Gets the etcd target.- Returns:
- the etcd target.
-
target
configure etcd server endpoints.- Parameters:
target- etcd server target- Returns:
- this builder to train
- Throws:
NullPointerException- if target is null or one of endpoint is null
-
endpoints
configure etcd server endpoints using theIPNameResolver.- Parameters:
endpoints- etcd server endpoints, at least one- Returns:
- this builder to train
- Throws:
NullPointerException- if endpoints is null or one of endpoint is nullIllegalArgumentException- if some endpoint is invalid
-
endpoints
configure etcd server endpoints using theIPNameResolver.- Parameters:
endpoints- etcd server endpoints, at least one- Returns:
- this builder to train
- Throws:
NullPointerException- if endpoints is null or one of endpoint is nullIllegalArgumentException- if some endpoint is invalid
-
endpoints
configure etcd server endpoints using theIPNameResolver.- Parameters:
endpoints- etcd server endpoints, at least one- Returns:
- this builder to train
- Throws:
NullPointerException- if endpoints is null or one of endpoint is nullIllegalArgumentException- if some endpoint is invalid
-
user
Returns the auth user- Returns:
- the user.
-
user
config etcd auth user.- Parameters:
user- etcd auth user- Returns:
- this builder
- Throws:
NullPointerException- if user isnull
-
password
Returns the auth password- Returns:
- the password.
-
password
config etcd auth password.- Parameters:
password- etcd auth password- Returns:
- this builder
- Throws:
NullPointerException- if password isnull
-
namespace
Returns the namespace of each key used- Returns:
- the namespace.
-
namespace
config the namespace of keys used inKV,Txn,LockandWatch. "/" will be treated as no namespace.- Parameters:
namespace- the namespace of each key used- Returns:
- this builder
- Throws:
NullPointerException- if namespace isnull
-
executorService
Returns the executor service- Returns:
- the executor service.
-
executorService
config executor service.- Parameters:
executorService- executor service- Returns:
- this builder
- Throws:
NullPointerException- if executorService isnull
-
loadBalancerPolicy
config load balancer policy.- Parameters:
loadBalancerPolicy- etcd load balancer policy- Returns:
- this builder
- Throws:
NullPointerException- if loadBalancerPolicy isnull
-
loadBalancerPolicy
get the load balancer policy for etcd client.- Returns:
- loadBalancerFactory
-
sslContext
public io.netty.handler.ssl.SslContext sslContext()Returns the ssl context- Returns:
- the ssl context.
-
sslContext
SSL/TLS context to use instead of the system default. It must have been configured withGrpcSslContexts, but options could have been overridden.- Parameters:
sslContext- the ssl context- Returns:
- this builder
-
sslContext
public ClientBuilder sslContext(Consumer<io.netty.handler.ssl.SslContextBuilder> consumer) throws SSLException Configure SSL/TLS context create throughGrpcSslContexts.forClient()to use.- Parameters:
consumer- the SslContextBuilder consumer- Returns:
- this builder
- Throws:
SSLException- if the SslContextBuilder fails
-
authority
Returns The authority used to authenticate connections to servers.- Returns:
- the authority.
-
authority
Sets the authority used to authenticate connections to servers.- Parameters:
authority- the authority used to authenticate connections to servers.- Returns:
- this builder
-
maxInboundMessageSize
Returns the maximum message size allowed for a single gRPC frame.- Returns:
- max inbound message size.
-
maxInboundMessageSize
Sets the maximum message size allowed for a single gRPC frame.- Parameters:
maxInboundMessageSize- the maximum message size allowed for a single gRPC frame.- Returns:
- this builder
-
headers
Returns the headers to be added to http request headers- Returns:
- headers.
-
headers
Sets headers to be added to http request headers.- Parameters:
headers- headers to be added to http request headers.- Returns:
- this builder
-
header
Set headers.- Parameters:
key- Sets an header key to be added to http request headers.value- Sets an header value to be added to http request headers.- Returns:
- this builder
-
authHeaders
Returns the headers to be added to auth request headers- Returns:
- auth headers.
-
authHeaders
Set the auth headers.- Parameters:
authHeaders- Sets headers to be added to auth request headers.- Returns:
- this builder
-
authHeader
Add an auth header.- Parameters:
key- Sets an header key to be added to auth request headers.value- Sets an header value to be added to auth request headers.- Returns:
- this builder
-
interceptors
Returns the interceptors- Returns:
- the interceptors.
-
interceptors
Set the interceptors.- Parameters:
interceptors- the interceptors.- Returns:
- this builder
-
interceptor
public ClientBuilder interceptor(io.grpc.ClientInterceptor interceptor, io.grpc.ClientInterceptor... interceptors) Add an interceptor.- Parameters:
interceptor- an interceptors to addinterceptors- additional interceptors- Returns:
- this builder
-
authInterceptors
Returns the auth interceptors- Returns:
- the interceptors.
-
authInterceptors
Set the auth interceptors.- Parameters:
interceptors- Set the interceptors to add to the auth chain- Returns:
- this builder
-
authInterceptors
public ClientBuilder authInterceptors(io.grpc.ClientInterceptor interceptor, io.grpc.ClientInterceptor... interceptors) Add an auth interceptor.- Parameters:
interceptor- an interceptors to add to the auth chaininterceptors- additional interceptors to add to the auth chain- Returns:
- this builder
-
retryDelay
public long retryDelay()Returns The delay between retries.- Returns:
- the retry delay.
-
retryDelay
The delay between retries.- Parameters:
retryDelay- The delay between retries.- Returns:
- this builder
-
retryMaxDelay
public long retryMaxDelay()Returns the max backing off delay between retries- Returns:
- max retry delay.
-
retryMaxDelay
Set the max backing off delay between retries.- Parameters:
retryMaxDelay- The max backing off delay between retries.- Returns:
- this builder
-
retryMaxAttempts
public int retryMaxAttempts()Returns the max number of retry attempts- Returns:
- max retry attempts.
-
retryMaxAttempts
Set the max number of retry attempts- Parameters:
retryMaxAttempts- The max retry attempts.- Returns:
- this builder
-
keepaliveTime
Returns the keep alive time.- Returns:
- keep alive time.
-
keepaliveTime
The interval for gRPC keepalives. The current minimum allowed by gRPC is 10s- Parameters:
keepaliveTime- time between keepalives- Returns:
- this builder
-
keepaliveTimeout
Returns the keep alive time out.- Returns:
- keep alive time out.
-
keepaliveTimeout
The timeout for gRPC keepalives- Parameters:
keepaliveTimeout- the gRPC keep alive timeout.- Returns:
- this builder
-
keepaliveWithoutCalls
-
keepaliveWithoutCalls
Keepalive option for gRPC- Parameters:
keepaliveWithoutCalls- the gRPC keep alive without calls.- Returns:
- this builder
-
retryChronoUnit
Returns he retries period unit.- Returns:
- the chrono unit.
-
retryChronoUnit
Sets the retries period unit.- Parameters:
retryChronoUnit- the retries period unit.- Returns:
- this builder
-
retryMaxDuration
Returns the retries max duration.- Returns:
- retry max duration.
-
connectTimeout
Returns the connect timeout.- Returns:
- connect timeout.
-
retryMaxDuration
Set the retries max duration.- Parameters:
retryMaxDuration- the retries max duration.- Returns:
- this builder
-
connectTimeout
Set the connection timeout.- Parameters:
connectTimeout- Sets the connection timeout. Clients connecting to fault tolerant etcd clusters (eg, clusters with more than 2 etcd server peers/endpoints) should consider a value that will allow switching timely from a crashed/partitioned peer to a consensus peer.- Returns:
- this builder
-
waitForReady
public boolean waitForReady()Enable gRPC's wait for ready semantics.- Returns:
- if this client uses gRPC's wait for ready semantics.
- See Also:
-
waitForReady
Configure the gRPC's wait for ready semantics.- Parameters:
waitForReady- if this client should use gRPC's wait for ready semantics. Enabled by default.- Returns:
- this builder.
- See Also:
-
build
build a new Client.- Returns:
- Client instance.
- Throws:
io.etcd.jetcd.common.exception.EtcdException- if client experiences build error.
-
copy
Returns a copy of this builder- Returns:
- a copy of the builder.
-