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>
where S: TryInto<ServiceDefinition> + 'static, S::Error: Into<Box<dyn Error + Send + Sync>> + Send + Sync,

source

pub fn new_with_service( service_definition: S ) -> LoadBalancedChannelBuilder<DnsResolver, S>

Set the ServiceDefinition of the gRPC server service

  • e.g. my.service.uri and 5000.

All the service endpoints of a ServiceDefinition will be constructed by resolving all ips from ServiceDefinition::hostname, and using the portnumber ServiceDefinition::port.

source

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>
where S: TryInto<ServiceDefinition> + 'static, S::Error: Into<Box<dyn Error + Send + Sync>> + Send + Sync,

source

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.

source

pub fn timeout(self, timeout: Duration) -> LoadBalancedChannelBuilder<T, S>

Set a request timeout that will be applied to every new Endpoint.

source

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.

source

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.

source

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.

source

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>
where S: Freeze, T: Freeze,

§

impl<T, S> RefUnwindSafe for LoadBalancedChannelBuilder<T, S>

§

impl<T, S> Send for LoadBalancedChannelBuilder<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for LoadBalancedChannelBuilder<T, S>
where S: Sync, T: Sync,

§

impl<T, S> Unpin for LoadBalancedChannelBuilder<T, S>
where S: Unpin, T: Unpin,

§

impl<T, S> UnwindSafe for LoadBalancedChannelBuilder<T, S>
where S: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more