pub struct SeppClientBuilder { /* private fields */ }Expand description
Configures and connects a SeppClient.
Created by SeppClient::builder. Set an api_key, a
retry_policy, and (with the tls feature) TLS
options, then call connect.
use sepp_rs::client::{RetryPolicy, SeppClient};
let client = SeppClient::builder("http://127.0.0.1:50051")
.api_key("secret")
.retry_policy(RetryPolicy::default().with_max_attempts(3))
.connect()
.await?;Implementations§
Source§impl SeppClientBuilder
impl SeppClientBuilder
Sourcepub fn api_key(self, key: impl Into<String>) -> Self
pub fn api_key(self, key: impl Into<String>) -> Self
Sends an Authorization: Bearer <key> header on every request.
Without TLS the key travels in plaintext, so connect
logs a warning if you set a key but no TLS.
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> Self
pub fn retry_policy(self, policy: RetryPolicy) -> Self
Sets the RetryPolicy for transient RPC failures. The default policy
does not retry.
Sourcepub fn rpc_timeout(self, timeout: Duration) -> Self
pub fn rpc_timeout(self, timeout: Duration) -> Self
Sets the per-call deadline for every unary RPC except
reserve, whose deadline follows the requested
wait timeout instead. Defaults to 30 seconds.
The deadline travels as the grpc-timeout request header and is
enforced by the server, not by a client-side timer.
Enqueuing very large batches may need a higher value.
Sourcepub fn max_receive_message_bytes(self, bytes: usize) -> Self
pub fn max_receive_message_bytes(self, bytes: usize) -> Self
Sets the largest gRPC message this client accepts, replacing tonic’s 4 MiB default.
Workers should consider raising this: a reserve response can carry up
to the server’s max_reserve_batch × max_payload_bytes, which can
exceed the 4 MiB default, and an oversized response fails client-side
while its jobs stay leased until they expire.
Sourcepub fn tls(self) -> Self
pub fn tls(self) -> Self
Enables TLS using the platform’s native root certificates.
Requires the tls feature.
Sourcepub fn tls_ca_certificate(self, pem: impl AsRef<[u8]>) -> Self
pub fn tls_ca_certificate(self, pem: impl AsRef<[u8]>) -> Self
Enables TLS and trusts the given PEM-encoded CA certificate, e.g. for a private/self-signed server.
Requires the tls feature.
Sourcepub fn tls_domain(self, domain: impl Into<String>) -> Self
pub fn tls_domain(self, domain: impl Into<String>) -> Self
Overrides the domain name verified against the server certificate, for when the connection address differs from the certificate’s name.
Requires the tls feature.
Sourcepub fn tls_config(self, config: ClientTlsConfig) -> Self
pub fn tls_config(self, config: ClientTlsConfig) -> Self
Sets a fully custom tonic ClientTlsConfig, replacing any TLS options
set by the other tls_* methods.
Requires the tls feature.
Sourcepub async fn connect(self) -> Result<SeppClient, ClientError>
pub async fn connect(self) -> Result<SeppClient, ClientError>
Connects to the server with the configured options, yielding a ready
SeppClient.
Auto Trait Implementations§
impl Freeze for SeppClientBuilder
impl RefUnwindSafe for SeppClientBuilder
impl Send for SeppClientBuilder
impl Sync for SeppClientBuilder
impl Unpin for SeppClientBuilder
impl UnsafeUnpin for SeppClientBuilder
impl UnwindSafe for SeppClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request