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_observability_bind_addr(self, bind_addr: SocketAddr) -> Self

Sets SOF_OBSERVABILITY_BIND.

pub fn with_observability_config( self, config: RuntimeObservabilityConfig, ) -> Self

Applies one typed runtime observability configuration bundle.

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_entrypoint_pinned(self, pinned: bool) -> Self

Sets SOF_GOSSIP_ENTRYPOINT_PINNED.

When enabled, runtime switching stays inside the configured entrypoint list instead of expanding to discovered gossip peers.

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_packet_workers(self, packet_workers: usize) -> Self

Sets SOF_PACKET_WORKERS.

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

Sets SOF_PACKET_WORKER_QUEUE_CAPACITY.

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

Sets SOF_GOSSIP_RECEIVER_CHANNEL_CAPACITY.

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

Sets SOF_GOSSIP_SOCKET_CONSUME_CHANNEL_CAPACITY.

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

Sets SOF_GOSSIP_RESPONSE_CHANNEL_CAPACITY.

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

Sets SOF_GOSSIP_CHANNEL_CONSUME_CAPACITY.

pub fn with_gossip_consume_threads(self, thread_count: usize) -> Self

Sets SOF_GOSSIP_CONSUME_THREADS.

pub fn with_gossip_listen_threads(self, thread_count: usize) -> Self

Sets SOF_GOSSIP_LISTEN_THREADS.

pub fn with_gossip_run_threads(self, thread_count: usize) -> Self

Sets SOF_GOSSIP_RUN_THREADS.

pub fn with_gossip_socket_consume_parallel_packet_threshold( self, packet_threshold: usize, ) -> Self

Sets SOF_GOSSIP_SOCKET_CONSUME_PARALLEL_PACKET_THRESHOLD.

pub fn with_gossip_stats_interval_secs(self, interval_secs: u64) -> Self

Sets SOF_GOSSIP_STATS_INTERVAL_SECS.

Use 0 to disable the gossip metrics thread.

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

Sets SOF_GOSSIP_SAMPLE_LOGS_ENABLED.

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

Sets SOF_DATASET_MAX_TRACKED_SLOTS.

pub fn with_dataset_retained_slot_lag(self, slot_lag: u64) -> Self

Sets SOF_DATASET_RETAINED_SLOT_LAG.

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_fec_retained_slot_lag(self, slot_lag: u64) -> Self

Sets SOF_FEC_RETAINED_SLOT_LAG.

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_skip_vote_only_tx_detail_path(self, enabled: bool) -> Self

Sets SOF_SKIP_VOTE_ONLY_TX_DETAIL_PATH.

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

Sets SOF_INLINE_TRANSACTION_DISPATCH.

This is an explicit runtime override. By default, SOF automatically chooses the inline transaction path when a compatible plugin opts in with crate::framework::PluginConfig::with_inline_transaction.

Setting this to false forces the standard dataset-worker path even for inline-capable plugins. Setting it to true keeps inline dispatch eligible, but incompatible dataset or derived-state consumers still force a fallback to the standard path.

pub fn with_standard_transaction_dispatch(self) -> Self

Forces the standard dataset-worker transaction path.

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_checkpoint_only(self) -> Self

Disables the runtime-owned replay tail and keeps derived-state recovery checkpoint-only.

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 explicitly, overriding the trust-mode default.

pub fn with_shred_trust_mode(self, mode: ShredTrustMode) -> Self

Sets SOF_SHRED_TRUST_MODE for raw-shred ingest.

pub fn with_provider_stream_capability_policy( self, policy: ProviderStreamCapabilityPolicy, ) -> Self

Sets SOF_PROVIDER_STREAM_CAPABILITY_POLICY.

pub fn with_provider_stream_allow_eof(self, allow_eof: bool) -> Self

Sets SOF_PROVIDER_STREAM_ALLOW_EOF.

When enabled, ProviderStreamMode::Generic may close its ingress queue cleanly after emitting a bounded stream.

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 explicitly, overriding the trust-mode default.

pub fn with_runtime_dataset_decode_failures_unhealthy_per_tick( self, failures: u64, ) -> Self

Sets SOF_RUNTIME_DATASET_DECODE_FAILURES_UNHEALTHY_PER_TICK.

pub fn with_runtime_dataset_tail_skips_unhealthy_per_tick( self, tail_skips: u64, ) -> Self

Sets SOF_RUNTIME_DATASET_TAIL_SKIPS_UNHEALTHY_PER_TICK.

pub fn with_runtime_dataset_unhealthy_sustain_ticks(self, ticks: u64) -> Self

Sets SOF_RUNTIME_DATASET_UNHEALTHY_SUSTAIN_TICKS.

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_tvu_receive_sockets(self, tvu_receive_sockets: usize) -> Self

Sets SOF_TVU_SOCKETS.

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_receiver_pin_by_port(self, enabled: bool) -> Self

Sets SOF_UDP_RECEIVER_PIN_BY_PORT.

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

Sets SOF_UDP_IDLE_WAIT_MS.

pub fn with_udp_busy_poll_us(self, busy_poll_us: u32) -> Self

Sets SOF_UDP_BUSY_POLL_US.

Linux only. Use 0 or leave unset to disable socket busy polling.

pub fn with_udp_busy_poll_budget(self, busy_poll_budget: u32) -> Self

Sets SOF_UDP_BUSY_POLL_BUDGET.

Linux only. This controls how many packets one busy-poll pass will try to drain.

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

Sets SOF_UDP_PREFER_BUSY_POLL.

Linux only. This asks the kernel to prefer busy polling for supported UDP sockets.

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_ingest_queue_mode_typed(self, mode: IngestQueueMode) -> Self

Sets SOF_INGEST_QUEUE_MODE from a typed queue mode.

pub fn with_sof_gossip_runtime_tuning(self, tuning: SofRuntimeTuning) -> Self

Applies one typed SOF-supported gossip/runtime tuning bundle.

pub fn with_gossip_tuning_profile(self, profile: GossipTuningProfile) -> Self

Applies one typed gossip host profile.

This applies the SOF runtime subset plus bundled gossip queue/worker tuning and semantic shred dedupe capacity.

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.

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

Sets SOF_GOSSIP_RUNTIME_SWITCH_PROACTIVE_ENABLED.

pub fn with_gossip_runtime_switch_proactive_eval_ms(self, eval_ms: u64) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_PROACTIVE_EVAL_MS.

pub fn with_gossip_runtime_switch_proactive_active_rank_max( self, active_rank_max: usize, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_PROACTIVE_ACTIVE_RANK_MAX.

pub fn with_gossip_runtime_switch_prioritized_candidates_max( self, candidates_max: usize, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_PRIORITIZED_CANDIDATES_MAX.

pub fn with_gossip_runtime_switch_stabilize_min_peers( self, min_peers: usize, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_STABILIZE_MIN_PEERS.

pub fn with_gossip_runtime_switch_proactive_stable_evals( self, stable_evals: usize, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_PROACTIVE_STABLE_EVALS.

pub fn with_gossip_runtime_switch_proactive_min_runtime_age_ms( self, age_ms: u64, ) -> Self

Sets SOF_GOSSIP_RUNTIME_SWITCH_PROACTIVE_MIN_RUNTIME_AGE_MS.

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

Sets SOF_GOSSIP_LOAD_SHED_ENABLED.

pub fn with_gossip_load_shed_queue_pressure_pct(self, pressure_pct: u64) -> Self

Sets SOF_GOSSIP_LOAD_SHED_QUEUE_PRESSURE_PCT.

pub fn with_verify_strict_unknown_queue_pressure_pct( self, pressure_pct: u64, ) -> Self

Sets SOF_VERIFY_STRICT_UNKNOWN_QUEUE_PRESSURE_PCT.

pub fn with_gossip_load_shed_keep_top_sources( self, keep_top_sources: usize, ) -> Self

Sets SOF_GOSSIP_LOAD_SHED_KEEP_TOP_SOURCES.

pub fn with_gossip_socket_consume_verify_queue_capacity( self, capacity: usize, ) -> Self

Sets SOF_GOSSIP_SOCKET_CONSUME_VERIFY_QUEUE_CAPACITY.

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