pub struct LoadBalancedChannelBuilder<T, S> { /* private fields */ }Expand description
Builder to configure and create a LoadBalancedChannel.
Implementations§
Source§impl<S> LoadBalancedChannelBuilder<DnsResolver, S>
impl<S> LoadBalancedChannelBuilder<DnsResolver, S>
Sourcepub fn new_with_service(
service_definition: S,
) -> LoadBalancedChannelBuilder<DnsResolver, S>
pub fn new_with_service( service_definition: S, ) -> LoadBalancedChannelBuilder<DnsResolver, S>
Set the ServiceDefinition of the gRPC server service
- e.g.
my.service.uriand5000.
All the service endpoints of a ServiceDefinition will be
constructed by resolving all ips from ServiceDefinition::hostname, and
using the portnumber ServiceDefinition::port.
Sourcepub fn lookup_service<T: LookupService + Send + Sync + 'static>(
self,
lookup_service: T,
) -> LoadBalancedChannelBuilder<T, S>
pub fn lookup_service<T: LookupService + Send + Sync + 'static>( self, lookup_service: T, ) -> LoadBalancedChannelBuilder<T, S>
Set a custom LookupService.
Source§impl<T: LookupService + Send + Sync + 'static + Sized, S> LoadBalancedChannelBuilder<T, S>
impl<T: LookupService + Send + Sync + 'static + Sized, S> LoadBalancedChannelBuilder<T, S>
Sourcepub fn dns_probe_interval(
self,
interval: Duration,
) -> LoadBalancedChannelBuilder<T, S>
pub fn dns_probe_interval( self, interval: Duration, ) -> LoadBalancedChannelBuilder<T, S>
Set the how often, the client should probe for changes to gRPC server endpoints. Default interval in seconds is 10.
Sourcepub fn timeout(self, timeout: Duration) -> LoadBalancedChannelBuilder<T, S>
pub fn timeout(self, timeout: Duration) -> LoadBalancedChannelBuilder<T, S>
Set a request timeout that will be applied to every new Endpoint.
Sourcepub fn connect_timeout(
self,
connection_timeout: Duration,
) -> LoadBalancedChannelBuilder<T, S>
pub fn connect_timeout( self, connection_timeout: Duration, ) -> LoadBalancedChannelBuilder<T, S>
Set a connection timeout that will be applied to every new Endpoint.
Defaults to the overall request timeout if not set.
Sourcepub fn resolution_strategy(
self,
resolution_strategy: ResolutionStrategy,
) -> LoadBalancedChannelBuilder<T, S>
pub fn resolution_strategy( self, resolution_strategy: ResolutionStrategy, ) -> LoadBalancedChannelBuilder<T, S>
Set the ResolutionStrategy.
Default set to ResolutionStrategy::Lazy.
If ResolutionStrategy::Lazy the domain name will be resolved after-the-fact.
Instead, if ResolutionStrategy::Eager is set the domain name will be attempted resolved
once before the LoadBalancedChannel is created, which ensures that the channel
will have a non-empty of IPs on startup. If it fails the channel creation will also fail.
Sourcepub fn with_tls(
self,
tls_config: ClientTlsConfig,
) -> LoadBalancedChannelBuilder<T, S>
pub fn with_tls( self, tls_config: ClientTlsConfig, ) -> LoadBalancedChannelBuilder<T, S>
Configure the channel to use tls.
A tls_config MUST be specified to use the HTTPS scheme.
Sourcepub async fn channel(self) -> Result<LoadBalancedChannel, Error>
pub async fn channel(self) -> Result<LoadBalancedChannel, Error>
Construct a LoadBalancedChannel from the LoadBalancedChannelBuilder instance.
Auto Trait Implementations§
impl<T, S> Freeze for LoadBalancedChannelBuilder<T, S>
impl<T, S> RefUnwindSafe for LoadBalancedChannelBuilder<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for LoadBalancedChannelBuilder<T, S>
impl<T, S> Sync for LoadBalancedChannelBuilder<T, S>
impl<T, S> Unpin for LoadBalancedChannelBuilder<T, S>
impl<T, S> UnwindSafe for LoadBalancedChannelBuilder<T, S>where
S: UnwindSafe,
T: UnwindSafe,
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> 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