[][src]Struct kompact::prelude::NetworkConfig

pub struct NetworkConfig { /* fields omitted */ }

Configuration builder for the network dispatcher

Example

This example binds to local host on a free port chosen by the operating system.

use kompact::prelude::*;

let mut conf = KompactConfig::default();
conf.system_components(DeadletterBox::new, NetworkConfig::default().build());
let system = conf.build().expect("system");

Implementations

impl NetworkConfig[src]

pub fn new(addr: SocketAddr) -> Self[src]

Create a new config with addr and protocol TCP NetworkDispatcher and NetworkThread will use the default BufferConfig

pub fn with_buffer_config(addr: SocketAddr, buffer_config: BufferConfig) -> Self[src]

Create a new config with addr and protocol TCP Note: Only the NetworkThread and NetworkDispatcher will use the BufferConfig, not Actors

pub fn with_custom_allocator(
    addr: SocketAddr,
    buffer_config: BufferConfig,
    custom_allocator: Arc<dyn ChunkAllocator>
) -> Self
[src]

Create a new config with addr and protocol TCP Note: Only the NetworkThread and NetworkDispatcher will use the BufferConfig, not Actors

pub fn with_socket(self, addr: SocketAddr) -> Self[src]

Replace the current socket address with addr.

pub fn build(self) -> impl Fn(KPromise<()>) -> NetworkDispatcher[src]

Complete the configuration and provide a function that produces a network dispatcher

Returns the appropriate function type for use with system_components.

pub fn get_buffer_config(&self) -> &BufferConfig[src]

Returns a pointer to the configurations BufferConfig.

pub fn set_buffer_config(&mut self, buffer_config: BufferConfig)[src]

Sets the configurations BufferConfig to buffer_config

pub fn get_custom_allocator(&self) -> &Option<Arc<dyn ChunkAllocator>>[src]

Returns a pointer to the CustomAllocator option so that it can be cloned by the caller.

pub fn get_tcp_nodelay(&self) -> bool[src]

Reads the tcp_nodelay parameter of the NetworkConfig.

pub fn set_tcp_nodelay(&mut self, nodelay: bool)[src]

If set to true the Nagle algorithm will be turned off for all TCP Network-channels.

Decreases network-latency at the cost of reduced throughput and increased congestion.

Default value is false, i.e. the Nagle algorithm is turned on by default.

pub fn set_max_connection_retry_attempts(&mut self, count: u8)[src]

Configures how many attempts at re-establishing a connection will be made before giving up and discarding the enqueued outgoing messages.

Default value is 10 times.

pub fn get_max_connection_retry_attempts(&self) -> u8[src]

Returns the number of times the system will retry before giving up on a connection.

pub fn set_connection_retry_interval(&mut self, milliseconds: u64)[src]

Configures how long to wait (in ms) between attempts at establishing a connection.

Default value is 5000 ms.

pub fn get_connection_retry_interval(&self) -> u64[src]

How long (in ms) the system will wait between attempts at re-establishing connection.

Trait Implementations

impl Clone for NetworkConfig[src]

impl Debug for NetworkConfig[src]

impl Default for NetworkConfig[src]

Socket defaults to 127.0.0.1:0 (i.e. a random local port) and protocol is TCP

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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