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>) -> Config
pub fn new(endpoint: impl Into<String>) -> Config
Create a configuration targeting endpoint, with no authentication and
no retrying.
Sourcepub fn with_token(self, token: impl Into<String>) -> Config
pub fn with_token(self, token: impl Into<String>) -> Config
Authenticate with a fixed bearer token.
Sourcepub fn with_oidc<T>(self, provider: T) -> Configwhere
T: TokenSource + 'static,
pub fn with_oidc<T>(self, provider: T) -> Configwhere
T: TokenSource + 'static,
Authenticate with a dynamic token source (e.g. an OIDC provider with client-credentials and auto-refresh).
Sourcepub fn with_retry(self, retry: RetryConfig) -> Config
pub fn with_retry(self, retry: RetryConfig) -> Config
Enable retrying of unary calls on retriable errors, per retry.
Sourcepub fn with_tls(self, tls: TlsConfig) -> Config
pub fn with_tls(self, tls: TlsConfig) -> Config
Use TLS for the gRPC channel (server-side and, if configured, mutual).
Sourcepub fn with_timeout(self, timeout: Duration) -> Config
pub fn with_timeout(self, timeout: Duration) -> Config
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, Error>
pub fn connect_channel(&self) -> Result<Channel, Error>
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 [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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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