Struct ginepro::LoadBalancedChannelBuilder
source · 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.uri
and5000
.
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