Skip to main content

NetworkConfig

Struct NetworkConfig 

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

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::*;
use kompact_net::NetworkConfig;

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

Implementations§

Source§

impl NetworkConfig

Source

pub fn new(addr: SocketAddr) -> Self

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

Source

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

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

Source

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

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

Source

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

Replace the current socket address with addr.

Source

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

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

Returns the appropriate function type for use with system_components.

Source

pub fn get_buffer_config(&self) -> &BufferConfig

Returns a pointer to the configurations BufferConfig.

Source

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

Sets the configurations BufferConfig to buffer_config

Source

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

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

Source

pub fn get_tcp_nodelay(&self) -> bool

Reads the tcp_nodelay parameter of the NetworkConfig.

Source

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

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.

Source

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

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.

Source

pub fn get_max_connection_retry_attempts(&self) -> u8

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

Source

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

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

Default value is 5000 ms.

Source

pub fn get_connection_retry_interval(&self) -> u64

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

Source

pub fn set_boot_timeout(&mut self, milliseconds: u64)

Configures how long the system will wait (in ms) for the network layer to set-up

Default value is 5000 ms.

Source

pub fn get_boot_timeout(&self) -> u64

How long (in ms) the system will wait (in ms) for the network layer to set-up

Source

pub fn set_soft_connection_limit(&mut self, limit: u32)

Configures how many concurrent Network-connections may be active at any point in time

When the limit is exceeded the system will gracefully close the least recently used channel.

Default value is 1000 Connections.

Source

pub fn get_soft_connection_limit(&self) -> u32

How many Active Network-connections the system will allow before it starts closing least recently used

Source

pub fn set_hard_connection_limit(&mut self, limit: u32)

Configures how many concurrent Network-connections the system may have at any point.

When the limit is exceeded the system will reject all incoming and outgoing requests for new connections.

Default value is 1100 Connections.

Source

pub fn get_hard_connection_limit(&self) -> u32

How many Network-connections the system will allow before it starts closing least recently used

Trait Implementations§

Source§

impl Clone for NetworkConfig

Source§

fn clone(&self) -> NetworkConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NetworkConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NetworkConfig

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DispatchEvent for T
where T: Any + Send + Debug,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any + Send>

Convert this event into an erased Any payload for downcasting.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, SerError>

Tries to produce a copy of self or returns an error
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> Erased for T

Source§

impl<M> MessageBounds for M
where M: Debug + Send + 'static,