Skip to main content

RuntimeSetup

Struct RuntimeSetup 

pub struct RuntimeSetup { /* private fields */ }
Expand description

Programmatic runtime setup that mirrors selected SOF environment variables.

This lets embedders configure startup in code while keeping SOF’s env-based configuration model for everything else.

Implementations§

§

impl RuntimeSetup

pub const fn new() -> Self

Creates an empty setup that preserves standard env/default behavior.

pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self

Adds an explicit env-style override.

pub fn with_rust_log_filter(self, filter: impl Into<String>) -> Self

Sets RUST_LOG.

pub fn with_bind_addr(self, bind_addr: SocketAddr) -> Self

Sets SOF_BIND.

pub fn with_gossip_entrypoints<I, S>(self, gossip_entrypoints: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets SOF_GOSSIP_ENTRYPOINT from a list of entrypoints.

pub fn with_gossip_validators<I, S>(self, gossip_validators: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Sets SOF_GOSSIP_VALIDATORS from a list of validator identity pubkeys.

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

Sets SOF_PORT_RANGE.

pub fn with_shred_version(self, shred_version: u16) -> Self

Sets SOF_SHRED_VERSION.

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

Sets SOF_LOG_STARTUP_STEPS.

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

Sets SOF_LOG_REPAIR_PEER_TRAFFIC.

pub fn with_repair_peer_traffic_every(self, every_n_events: u64) -> Self

Sets SOF_LOG_REPAIR_PEER_TRAFFIC_EVERY.

pub fn with_worker_threads(self, worker_threads: usize) -> Self

Sets SOF_WORKER_THREADS.

pub fn with_dataset_workers(self, dataset_workers: usize) -> Self

Sets SOF_DATASET_WORKERS.

pub fn with_dataset_max_tracked_slots(self, max_tracked_slots: usize) -> Self

Sets SOF_DATASET_MAX_TRACKED_SLOTS.

pub fn with_dataset_queue_capacity(self, queue_capacity: usize) -> Self

Sets SOF_DATASET_QUEUE_CAPACITY.

pub fn with_fec_max_tracked_sets(self, max_tracked_sets: usize) -> Self

Sets SOF_FEC_MAX_TRACKED_SETS.

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

Sets SOF_LOG_ALL_TXS.

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

Sets SOF_LOG_NON_VOTE_TXS.

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

Sets SOF_LOG_DATASET_RECONSTRUCTION.

pub fn with_derived_state_checkpoint_interval_ms(self, interval_ms: u64) -> Self

Sets SOF_DERIVED_STATE_CHECKPOINT_INTERVAL_MS.

Use 0 to disable periodic checkpoint barriers.

pub fn with_derived_state_recovery_interval_ms(self, interval_ms: u64) -> Self

Sets SOF_DERIVED_STATE_RECOVERY_INTERVAL_MS.

Use 0 to disable periodic replay-based recovery attempts for unhealthy consumers.

pub fn with_derived_state_replay_max_envelopes( self, max_envelopes: usize, ) -> Self

Sets SOF_DERIVED_STATE_REPLAY_MAX_ENVELOPES.

Use 0 to disable the runtime-owned retained replay tail.

pub fn with_derived_state_replay_max_sessions(self, max_sessions: usize) -> Self

Sets SOF_DERIVED_STATE_REPLAY_MAX_SESSIONS.

Used by the disk backend to compact older session logs.

pub fn with_derived_state_config( self, config: DerivedStateRuntimeConfig, ) -> Self

Applies one typed derived-state configuration bundle.

pub fn with_derived_state_replay_backend( self, backend: DerivedStateReplayBackend, ) -> Self

Sets SOF_DERIVED_STATE_REPLAY_BACKEND.

pub fn with_derived_state_replay_dir( self, replay_dir: impl Into<PathBuf>, ) -> Self

Sets SOF_DERIVED_STATE_REPLAY_DIR.

pub fn with_derived_state_replay_durability( self, durability: DerivedStateReplayDurability, ) -> Self

Sets SOF_DERIVED_STATE_REPLAY_DURABILITY.

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

Sets SOF_LIVE_SHREDS_ENABLED.

When false, runtime keeps control-plane hooks active but skips live shred data-plane processing (on_raw_packet, on_shred, datasets, txs).

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

Sets SOF_VERIFY_SHREDS.

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

Sets SOF_VERIFY_STRICT.

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

Sets SOF_VERIFY_RECOVERED_SHREDS.

pub fn with_verify_slot_window(self, slot_window: u64) -> Self

Sets SOF_VERIFY_SLOT_WINDOW.

pub fn with_verify_signature_cache_entries(self, entries: usize) -> Self

Sets SOF_VERIFY_SIGNATURE_CACHE.

pub fn with_shred_dedupe_capacity(self, dedupe_capacity: usize) -> Self

Sets SOF_SHRED_DEDUP_CAPACITY.

pub fn with_shred_dedupe_ttl_ms(self, dedupe_ttl_ms: u64) -> Self

Sets SOF_SHRED_DEDUP_TTL_MS.

pub fn with_udp_receiver_core(self, core_index: usize) -> Self

Sets SOF_UDP_RECEIVER_CORE.

pub fn with_udp_rcvbuf_bytes(self, rcvbuf_bytes: usize) -> Self

Sets SOF_UDP_RCVBUF.

pub fn with_udp_batch_size(self, batch_size: usize) -> Self

Sets SOF_UDP_BATCH_SIZE.

pub fn with_udp_batch_max_wait_ms(self, batch_max_wait_ms: u64) -> Self

Sets SOF_UDP_BATCH_MAX_WAIT_MS.

pub fn with_udp_idle_wait_ms(self, idle_wait_ms: u64) -> Self

Sets SOF_UDP_IDLE_WAIT_MS.

pub fn with_ingest_queue_mode(self, mode: impl Into<String>) -> Self

Sets SOF_INGEST_QUEUE_MODE.

Accepted values:

  • bounded (default): Tokio bounded channel.
  • unbounded: Tokio unbounded channel.
  • lockfree: lock-free ArrayQueue ring with async wakeups.

pub fn with_ingest_queue_capacity(self, queue_capacity: usize) -> Self

Sets SOF_INGEST_QUEUE_CAPACITY.

Used by bounded and lockfree modes.

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

Sets SOF_REPAIR_ENABLED.

pub fn with_repair_tick_ms(self, repair_tick_ms: u64) -> Self

Sets SOF_REPAIR_TICK_MS.

pub fn with_repair_slot_window(self, repair_slot_window: u64) -> Self

Sets SOF_REPAIR_SLOT_WINDOW.

pub fn with_repair_peer_sample_size(self, peer_sample_size: usize) -> Self

Sets SOF_REPAIR_PEER_SAMPLE_SIZE.

pub fn with_repair_serve_max_bytes_per_sec(self, bytes_per_sec: usize) -> Self

Sets SOF_REPAIR_SERVE_MAX_BYTES_PER_SEC.

pub fn with_repair_serve_unstaked_max_bytes_per_sec( self, bytes_per_sec: usize, ) -> Self

Sets SOF_REPAIR_SERVE_UNSTAKED_MAX_BYTES_PER_SEC.

pub fn with_repair_serve_max_requests_per_peer_per_sec( self, requests_per_sec: usize, ) -> Self

Sets SOF_REPAIR_SERVE_MAX_REQUESTS_PER_PEER_PER_SEC.

pub fn with_repair_max_requests_per_tick( self, max_requests_per_tick: usize, ) -> Self

Sets SOF_REPAIR_MAX_REQUESTS_PER_TICK.

pub fn with_repair_tip_stall_ms(self, tip_stall_ms: u64) -> Self

Sets SOF_REPAIR_TIP_STALL_MS.

pub fn with_repair_dataset_stall_ms(self, dataset_stall_ms: u64) -> Self

Sets SOF_REPAIR_DATASET_STALL_MS.

pub fn with_repair_stall_sustain_ms(self, stall_sustain_ms: u64) -> Self

Sets SOF_REPAIR_STALL_SUSTAIN_MS.

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

Sets SOF_GOSSIP_RUNTIME_SWITCH_ENABLED.

pub fn with_gossip_runtime_switch_stall_ms(self, switch_stall_ms: u64) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_STALL_MS.

pub fn with_gossip_runtime_switch_dataset_stall_ms( self, switch_dataset_stall_ms: u64, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_DATASET_STALL_MS.

pub fn with_gossip_runtime_switch_cooldown_ms( self, switch_cooldown_ms: u64, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_COOLDOWN_MS.

pub fn with_gossip_runtime_switch_warmup_ms(self, switch_warmup_ms: u64) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_WARMUP_MS.

Trait Implementations§

§

impl Clone for RuntimeSetup

§

fn clone(&self) -> RuntimeSetup

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
§

impl Debug for RuntimeSetup

§

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

Formats the value using the given formatter. Read more
§

impl Default for RuntimeSetup

§

fn default() -> RuntimeSetup

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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