Skip to main content

BrokerConfig

Struct BrokerConfig 

Source
pub struct BrokerConfig {
Show 16 fields pub callback_port_range: (u16, u16), pub event_timeout: Duration, pub polling_activation_delay: Duration, pub base_polling_interval: Duration, pub max_polling_interval: Duration, pub subscription_timeout: Duration, pub event_buffer_size: usize, pub max_concurrent_polls: usize, pub enable_proactive_firewall_detection: bool, pub firewall_event_wait_timeout: Duration, pub enable_firewall_caching: bool, pub max_cached_device_states: usize, pub max_registrations: usize, pub adaptive_polling: bool, pub renewal_threshold: Duration, pub force_polling_mode: bool,
}
Expand description

Configuration for the EventBroker

This struct controls all aspects of the event broker’s behavior, from callback server settings to polling intervals and firewall detection.

Fields§

§callback_port_range: (u16, u16)

Port range for the callback server Default: (3400, 3500)

§event_timeout: Duration

Timeout for detecting event failures (fallback after proactive detection) Default: 30 seconds

§polling_activation_delay: Duration

Delay after proactive firewall detection before activating polling Default: 5 seconds

§base_polling_interval: Duration

Base interval for polling operations Default: 5 seconds

§max_polling_interval: Duration

Maximum interval for adaptive polling Default: 30 seconds

§subscription_timeout: Duration

Timeout for UPnP subscriptions Default: 1800 seconds (30 minutes)

§event_buffer_size: usize

Buffer size for event channels Default: 1000

§max_concurrent_polls: usize

Maximum number of concurrent polling tasks Default: 50

§enable_proactive_firewall_detection: bool

Enable proactive firewall detection Default: true

§firewall_event_wait_timeout: Duration

Timeout for waiting for first event to determine firewall status Default: 15 seconds

§enable_firewall_caching: bool

Enable per-device firewall detection caching Default: true

§max_cached_device_states: usize

Maximum number of cached device firewall states Default: 100

§max_registrations: usize

Maximum number of registrations allowed Default: 1000

§adaptive_polling: bool

Enable adaptive polling intervals based on change frequency Default: true

§renewal_threshold: Duration

Threshold for subscription renewal (time before expiration) Default: 5 minutes

§force_polling_mode: bool

Force polling mode — skip UPnP subscriptions and go straight to polling Simulates a firewall that blocks all callback traffic. Useful for testing. Default: false

Implementations§

Source§

impl BrokerConfig

Source

pub fn new() -> Self

Create a new BrokerConfig with default values

Source

pub fn fast_polling() -> Self

Create a BrokerConfig optimized for fast polling fallback

Source

pub fn resource_efficient() -> Self

Create a BrokerConfig optimized for resource efficiency

Source

pub fn no_firewall_detection() -> Self

Create a BrokerConfig with firewall detection disabled

Source

pub fn firewall_simulation() -> Self

Create a BrokerConfig that simulates a firewall by forcing polling mode Useful for testing firewall fallback behavior without a real firewall

Source

pub fn validate(&self) -> Result<(), BrokerError>

Validate the configuration and return any issues

Source

pub fn with_callback_ports(self, start: u16, end: u16) -> Self

Builder pattern methods for fluent configuration

Source

pub fn with_polling_interval(self, base: Duration, max: Duration) -> Self

Source

pub fn with_event_timeout(self, timeout: Duration) -> Self

Source

pub fn with_buffer_size(self, size: usize) -> Self

Source

pub fn with_firewall_detection(self, enabled: bool) -> Self

Source

pub fn with_force_polling(self, enabled: bool) -> Self

Trait Implementations§

Source§

impl Clone for BrokerConfig

Source§

fn clone(&self) -> BrokerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BrokerConfig

Source§

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

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

impl Default for BrokerConfig

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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, 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more