Skip to main content

HydraConfig

Struct HydraConfig 

Source
pub struct HydraConfig {
    pub max_connections: u64,
    pub accept_timeout: u64,
    pub fixed_packet_length: u64,
    pub channel_capacity: u64,
    pub overflow_mode: ChannelOverflowStrategy,
    /* private fields */
}
Expand description

Configuration for the HydraServer features.

Fields§

§max_connections: u64

Maximum number of concurrent connections allowed.

§accept_timeout: u64

Timeout in milliseconds for accepting new connections when capacity is reached.

§fixed_packet_length: u64

Fixed length of a single packet/frame in bytes to read/write (excluding AES-GCM overhead). This length is used to read/write EXACT data from/to the network stream.

§channel_capacity: u64

Capacity of the internal channel for each session.

§overflow_mode: ChannelOverflowStrategy

Strategy for handling channel overflow when consumers cannot keep up with producers.

Implementations§

Source§

impl HydraConfig

Source

pub fn config( max_connections: u64, accept_timeout: u64, fixed_packet_length: u64, channel_capacity: u64, overflow_mode: ChannelOverflowStrategy, ) -> Self

Creates HydraConfig with the specified parameters.

NOTE: fixed_packet_length is the length of the plaintext data, the actual read/write length will be fixed_packet_length + AES-GCM overhead (28 bytes). So this function adds the AES-GCM overhead to the fixed_packet_length (make sure to consider for it, if HydraConfig is constructed without calling this function).

Trait Implementations§

Source§

impl Default for HydraConfig

Source§

fn default() -> Self

Default HydraConfig

  • max_connections: 32
  • accept_timeout: 500 ms
  • fixed_packet_length: 4 MB + AES-GCM overhead (28 bytes)
  • channel_capacity: 256
  • overflow_mode: DropPacket

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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.