pub struct Config { /* private fields */ }Expand description
Configuration for an SDK gRPC client (shared by canton-ledger and
canton-admin).
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(endpoint: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>) -> Self
Create a configuration targeting endpoint, with no authentication and
no retrying.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Authenticate with a fixed bearer token.
Sourcepub fn with_oidc<T: TokenSource + 'static>(self, provider: T) -> Self
pub fn with_oidc<T: TokenSource + 'static>(self, provider: T) -> Self
Authenticate with a dynamic token source (e.g. an OIDC provider with client-credentials and auto-refresh).
Sourcepub fn with_retry(self, retry: RetryConfig) -> Self
pub fn with_retry(self, retry: RetryConfig) -> Self
Enable retrying of unary calls on retriable errors, per retry.
Sourcepub fn with_tls(self, tls: TlsConfig) -> Self
pub fn with_tls(self, tls: TlsConfig) -> Self
Use TLS for the gRPC channel (server-side and, if configured, mutual).
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the per-request timeout on the gRPC channel (default 30s). Long
submitAndWait calls under load may need a higher bound.
Sourcepub fn endpoint(&self) -> &str
pub fn endpoint(&self) -> &str
The gRPC endpoint of the target service, e.g. http://localhost:3901.
Sourcepub fn retry(&self) -> Option<&RetryConfig>
pub fn retry(&self) -> Option<&RetryConfig>
The configured retry policy, if any.
Sourcepub fn connect_channel(&self) -> Result<Channel>
pub fn connect_channel(&self) -> Result<Channel>
Build a lazily-connected gRPC Channel for this configuration.
Returns immediately; the TCP/TLS handshake happens on the first RPC. TLS
is applied when Config::with_tls was set or the endpoint is https;
a with_tls endpoint given as http:// is normalised to https:// so
TLS is never silently downgraded (see the private resolve_endpoint).
§Errors
Returns Error::InvalidRequest if the endpoint URI or the TLS
configuration is invalid.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Config
impl !UnwindSafe for Config
impl Freeze for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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::RequestSource§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