Struct grpcio::ChannelBuilder
source · [−]pub struct ChannelBuilder { /* private fields */ }
Expand description
Channel
factory in order to configure the properties.
Implementations
sourceimpl ChannelBuilder
impl ChannelBuilder
sourcepub fn secure_connect(self, addr: &str, creds: ChannelCredentials) -> Channel
pub fn secure_connect(self, addr: &str, creds: ChannelCredentials) -> Channel
Build a secure Channel
that connects to a specific address.
sourceimpl ChannelBuilder
impl ChannelBuilder
sourcepub fn new(env: Arc<Environment>) -> ChannelBuilder
pub fn new(env: Arc<Environment>) -> ChannelBuilder
Initialize a new ChannelBuilder
.
Set default authority to pass if none specified on call construction.
sourcepub fn set_resource_quota(self, quota: ResourceQuota) -> ChannelBuilder
pub fn set_resource_quota(self, quota: ResourceQuota) -> ChannelBuilder
Set resource quota by consuming a ResourceQuota
sourcepub fn max_concurrent_stream(self, num: i32) -> ChannelBuilder
pub fn max_concurrent_stream(self, num: i32) -> ChannelBuilder
Set maximum number of concurrent incoming streams to allow on a HTTP/2 connection.
sourcepub fn max_receive_message_len(self, len: i32) -> ChannelBuilder
pub fn max_receive_message_len(self, len: i32) -> ChannelBuilder
Set maximum message length that the channel can receive. -1
means unlimited.
sourcepub fn max_send_message_len(self, len: i32) -> ChannelBuilder
pub fn max_send_message_len(self, len: i32) -> ChannelBuilder
Set maximum message length that the channel can send. -1
means unlimited.
sourcepub fn max_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder
pub fn max_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder
Set maximum time between subsequent connection attempts.
sourcepub fn initial_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder
pub fn initial_reconnect_backoff(self, backoff: Duration) -> ChannelBuilder
Set time between the first and second connection attempts.
sourcepub fn https_initial_seq_number(self, number: i32) -> ChannelBuilder
pub fn https_initial_seq_number(self, number: i32) -> ChannelBuilder
Set initial sequence number for HTTP/2 transports.
sourcepub fn stream_initial_window_size(self, window_size: i32) -> ChannelBuilder
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.
sourcepub fn primary_user_agent(self, agent: &str) -> ChannelBuilder
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.
sourcepub fn reuse_port(self, reuse: bool) -> ChannelBuilder
pub fn reuse_port(self, reuse: bool) -> ChannelBuilder
Set whether to allow the use of SO_REUSEPORT
if available. Defaults to true
.
sourcepub fn tcp_read_chunk_size(self, bytes: i32) -> ChannelBuilder
pub fn tcp_read_chunk_size(self, bytes: i32) -> ChannelBuilder
Set the size of slice to try and read from the wire each time.
sourcepub fn tcp_min_read_chunk_size(self, bytes: i32) -> ChannelBuilder
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.
sourcepub fn tcp_max_read_chunk_size(self, bytes: i32) -> ChannelBuilder
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.
sourcepub fn http2_write_buffer_size(self, size: i32) -> ChannelBuilder
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.
sourcepub fn http2_max_frame_size(self, size: i32) -> ChannelBuilder
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.
sourcepub fn http2_bdp_probe(self, enable: bool) -> ChannelBuilder
pub fn http2_bdp_probe(self, enable: bool) -> ChannelBuilder
Set whether to enable BDP probing.
sourcepub fn http2_min_sent_ping_interval_without_data(
self,
interval: Duration
) -> ChannelBuilder
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.
sourcepub fn http2_min_recv_ping_interval_without_data(
self,
interval: Duration
) -> ChannelBuilder
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.
sourcepub fn http2_max_pings_without_data(self, num: i32) -> ChannelBuilder
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)
sourcepub fn http2_max_ping_strikes(self, num: i32) -> ChannelBuilder
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)
sourcepub fn enable_http_proxy(self, num: bool) -> ChannelBuilder
pub fn enable_http_proxy(self, num: bool) -> ChannelBuilder
If set to zero, disables use of http proxies.
sourcepub fn default_compression_algorithm(
self,
algo: CompressionAlgorithms
) -> ChannelBuilder
pub fn default_compression_algorithm(
self,
algo: CompressionAlgorithms
) -> ChannelBuilder
Set default compression algorithm for the channel.
sourcepub fn default_gzip_compression_level(self, level: usize) -> ChannelBuilder
pub fn default_gzip_compression_level(self, level: usize) -> ChannelBuilder
Set default gzip compression level.
sourcepub fn default_grpc_min_message_size_to_compress(
self,
lower_bound: usize
) -> ChannelBuilder
pub fn default_grpc_min_message_size_to_compress(
self,
lower_bound: usize
) -> ChannelBuilder
Set default grpc min message size to compression.
sourcepub fn default_compression_level(self, level: CompressionLevel) -> ChannelBuilder
pub fn default_compression_level(self, level: CompressionLevel) -> ChannelBuilder
Set default compression level for the channel.
sourcepub fn keepalive_time(self, timeout: Duration) -> ChannelBuilder
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.
sourcepub fn keepalive_timeout(self, timeout: Duration) -> ChannelBuilder
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.
sourcepub fn keepalive_permit_without_calls(self, allow: bool) -> ChannelBuilder
pub fn keepalive_permit_without_calls(self, allow: bool) -> ChannelBuilder
Is it permissible to send keepalive pings without any outstanding streams.
sourcepub fn optimize_for(self, target: OptTarget) -> ChannelBuilder
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
.
sourcepub fn load_balancing_policy(self, lb_policy: LbPolicy) -> ChannelBuilder
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.
sourcepub fn use_local_subchannel_pool(self, enable: bool) -> ChannelBuilder
pub fn use_local_subchannel_pool(self, enable: bool) -> ChannelBuilder
Set use local subchannel pool
This method allows channel use it’s owned subchannel pool.
sourcepub fn build_args(&self) -> ChannelArgs
pub fn build_args(&self) -> ChannelArgs
Build ChannelArgs
from the current configuration.
sourcepub fn connect(self, addr: &str) -> Channel
pub fn connect(self, addr: &str) -> Channel
Build an insecure Channel
that connects to a specific address.
sourcepub unsafe fn connect_from_fd(self, target: &str, fd: c_int) -> Channel
pub unsafe fn connect_from_fd(self, target: &str, fd: c_int) -> Channel
Build an insecure Channel
taking over an established connection from
a file descriptor. The target string given is purely informative to
describe the endpoint of the connection. Takes ownership of the given
file descriptor and will close it when the connection is closed.
This function is available on posix systems only.
Safety
The file descriptor must correspond to a connected stream socket. After this call, the socket must not be accessed (read / written / closed) by other code.
Auto Trait Implementations
impl !RefUnwindSafe for ChannelBuilder
impl !Send for ChannelBuilder
impl !Sync for ChannelBuilder
impl Unpin for ChannelBuilder
impl !UnwindSafe for ChannelBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more