Struct ChannelBuilder

Source
pub struct ChannelBuilder { /* private fields */ }
Expand description

Channel factory in order to configure the properties.

Implementations§

Source§

impl ChannelBuilder

Source

pub fn new(env: Arc<Environment>) -> ChannelBuilder

Initialize a new ChannelBuilder.

Source

pub fn default_authority<S>(self, authority: S) -> ChannelBuilder
where S: Into<Vec<u8>>,

Set default authority to pass if none specified on call construction.

Source

pub fn set_resource_quota(self, quota: ResourceQuota) -> ChannelBuilder

Set resource quota by consuming a ResourceQuota

Source

pub fn max_concurrent_stream(self, num: i32) -> ChannelBuilder

Set maximum number of concurrent incoming streams to allow on a HTTP/2 connection.

Source

pub fn max_receive_message_len(self, len: i32) -> ChannelBuilder

Set maximum message length that the channel can receive. usize::MAX means unlimited.

Source

pub fn max_send_message_len(self, len: i32) -> ChannelBuilder

Set maximum message length that the channel can send. -1 means unlimited.

Source

pub fn max_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder

Set maximum time between subsequent connection attempts.

Source

pub fn initial_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder

Set time between the first and second connection attempts.

Source

pub fn https_initial_seq_number(self, number: i32) -> ChannelBuilder

Set initial sequence number for HTTP/2 transports.

Source

pub fn stream_initial_window_size(self, window_size: i32) -> ChannelBuilder

Set amount to read ahead on individual streams. Defaults to 64KB. Larger values help throughput on high-latency connections.

Source

pub fn primary_user_agent(self, agent: &str) -> ChannelBuilder

Set primary user agent, which goes at the start of the user-agent metadata sent on each request.

Source

pub fn reuse_port(self, reuse: bool) -> ChannelBuilder

Set whether to allow the use of SO_REUSEPORT if available. Defaults to true.

Source

pub fn tcp_read_chunk_size(self, bytes: i32) -> ChannelBuilder

Set the size of slice to try and read from the wire each time.

Source

pub fn tcp_min_read_chunk_size(self, bytes: i32) -> ChannelBuilder

Set the minimum size of slice to try and read from the wire each time.

Source

pub fn tcp_max_read_chunk_size(self, bytes: i32) -> ChannelBuilder

Set the maximum size of slice to try and read from the wire each time.

Source

pub fn http2_write_buffer_size(self, size: i32) -> ChannelBuilder

How much data are we willing to queue up per stream if write_buffer_hint is set. This is an upper bound.

Source

pub fn http2_max_frame_size(self, size: i32) -> ChannelBuilder

How big a frame are we willing to receive via HTTP/2. Min 16384, max 16777215. Larger values give lower CPU usage for large messages, but more head of line blocking for small messages.

Source

pub fn http2_bdp_probe(self, enable: bool) -> ChannelBuilder

Set whether to enable BDP probing.

Source

pub fn http2_min_sent_ping_interval_without_data( self, interval: Duration, ) -> ChannelBuilder

Minimum time between sending successive ping frames without receiving any data frame.

Source

pub fn http2_min_recv_ping_interval_without_data( self, interval: Duration, ) -> ChannelBuilder

Minimum allowed time between receiving successive ping frames without sending any data frame.

Source

pub fn http2_max_pings_without_data(self, num: i32) -> ChannelBuilder

How many pings can we send before needing to send a data frame or header frame? (0 indicates that an infinite number of pings can be sent without sending a data frame or header frame)

Source

pub fn http2_max_ping_strikes(self, num: i32) -> ChannelBuilder

How many misbehaving pings the server can bear before sending goaway and closing the transport? (0 indicates that the server can bear an infinite number of misbehaving pings)

Source

pub fn default_compression_algorithm( self, algo: grpc_compression_algorithm, ) -> ChannelBuilder

Set default compression algorithm for the channel.

Source

pub fn default_compression_level( self, level: grpc_compression_level, ) -> ChannelBuilder

Set default compression level for the channel.

Source

pub fn keepalive_time(self, timeout: Duration) -> ChannelBuilder

After a duration of this time the client/server pings its peer to see if the transport is still alive.

Source

pub fn keepalive_timeout(self, timeout: Duration) -> ChannelBuilder

After waiting for a duration of this time, if the keepalive ping sender does not receive the ping ack, it will close the transport.

Source

pub fn keepalive_permit_without_calls(self, allow: bool) -> ChannelBuilder

Is it permissible to send keepalive pings without any outstanding streams.

Source

pub fn optimize_for(self, target: OptTarget) -> ChannelBuilder

Set optimization target for the channel. See OptTarget for all available optimization targets. Defaults to OptTarget::Blend.

Source

pub fn load_balancing_policy(self, lb_policy: LbPolicy) -> ChannelBuilder

Set LbPolicy for channel

This method allows one to set the load-balancing policy for a given channel.

Source

pub fn build_args(&self) -> ChannelArgs

Build ChannelArgs from the current configuration.

Source

pub fn connect(self, addr: &str) -> Channel

Build an insecure Channel that connects to a specific address.

Source§

impl ChannelBuilder

Source

pub fn secure_connect(self, addr: &str, creds: ChannelCredentials) -> Channel

Build a secure Channel that connects to a specific address.

Auto Trait Implementations§

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.