Skip to main content

LiveNodeBuilder

Struct LiveNodeBuilder 

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

Builder for constructing a LiveNode with a fluent API.

Provides configuration options specific to live nodes, including client factory registration, timeout settings, and optional event-store injection for run-lifecycle audit and replay (see Self::with_event_store).

Implementations§

Source§

impl LiveNodeBuilder

Source

pub fn new(trader_id: TraderId, environment: Environment) -> Result<Self>

Creates a new LiveNodeBuilder with required parameters.

§Errors

Returns an error if environment is invalid (BACKTEST).

Source

pub fn from_config(config: LiveNodeConfig) -> Result<Self>

Creates a new LiveNodeBuilder from an existing LiveNodeConfig.

§Errors

Returns an error if the config’s environment is invalid (BACKTEST).

Source

pub fn name(&self) -> &str

Returns the name for the node.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Set the name for the node.

Source

pub const fn with_instance_id(self, instance_id: UUID4) -> Self

Set the instance ID for the node.

Source

pub const fn with_load_state(self, load_state: bool) -> Self

Configure whether to load state on startup.

Source

pub const fn with_save_state(self, save_state: bool) -> Self

Configure whether to save state on shutdown.

Source

pub fn with_controller(self, controller: ImportableControllerConfig) -> Self

Set the importable controller configuration for the node.

The controller is instantiated and registered with the trader during LiveNodeBuilder::build, enabling runtime strategy/actor management (create, start, stop, remove) without restarting the node. This mirrors the controller field on LiveNodeConfig used by the config-based LiveNode::build path, so a builder that also registers client factories can host a controller in a single node.

Source

pub const fn with_timeout_connection(self, timeout_secs: u64) -> Self

Set the connection timeout in seconds.

Source

pub const fn with_timeout_reconciliation(self, timeout_secs: u64) -> Self

Set the reconciliation timeout in seconds.

Source

pub fn with_reconciliation(self, reconciliation: bool) -> Self

Configure whether to run startup reconciliation.

Source

pub fn with_reconciliation_lookback_mins(self, mins: u32) -> Self

Set the reconciliation lookback in minutes.

Source

pub const fn with_timeout_portfolio(self, timeout_secs: u64) -> Self

Set the portfolio initialization timeout in seconds.

Source

pub const fn with_timeout_disconnection_secs(self, timeout_secs: u64) -> Self

Set the disconnection timeout in seconds.

Source

pub const fn with_delay_post_stop_secs(self, delay_secs: u64) -> Self

Set the post-stop delay in seconds.

Source

pub const fn with_delay_shutdown_secs(self, delay_secs: u64) -> Self

Set the shutdown timeout in seconds.

Source

pub fn with_clock_factory<F>(self, factory: F) -> Self
where F: Fn() -> Rc<RefCell<dyn Clock>> + 'static,

Inject a caller-supplied clock factory for the kernel and component clocks.

Source

pub fn with_cache_config(self, config: CacheConfig) -> Self

Set the cache configuration.

Source

pub fn with_cache_database_factory( self, factory: Box<dyn CacheDatabaseFactory>, ) -> Self

Install the cache database backing from a factory.

The node constructs and owns the adapter when it starts, so the load_state and save_state settings on LiveNodeConfig take effect.

Source

pub fn with_msgbus_config(self, config: MessageBusConfig) -> Self

Set the message bus configuration.

External streams are consumed when an ingress implementation is injected with Self::with_external_ingress or built from Self::with_external_msgbus_factory.

Source

pub fn with_portfolio_config(self, config: PortfolioConfig) -> Self

Set the portfolio configuration.

Source

pub fn with_streaming_config(self, config: StreamingConfig) -> Self

Set the streaming configuration.

The Rust live runtime does not support this setting yet. build() returns an error when it is set.

Source

pub fn with_data_engine_config(self, config: LiveDataEngineConfig) -> Self

Set the data engine configuration.

The Rust live runtime currently supports only the default qsize. build() returns an error for other values.

Source

pub fn with_risk_engine_config(self, config: LiveRiskEngineConfig) -> Self

Set the risk engine configuration.

The Rust live runtime currently supports only the default qsize. build() returns an error for other values.

Source

pub fn with_exec_engine_config(self, config: LiveExecEngineConfig) -> Self

Set the execution engine configuration.

The Rust live runtime currently supports only the default qsize. build() returns an error for other values.

Source

pub fn with_event_store<F>(self, factory: F) -> Self
where F: FnOnce(UUID4, Rc<RefCell<dyn Clock>>) -> Result<Box<dyn KernelEventStore>> + 'static,

Inject an event-store implementation to drive run-lifecycle capture.

The factory receives the kernel’s instance id and clock so the returned KernelEventStore shares the same time source the kernel uses to stamp run lifecycle entries. The concrete implementation lives outside this crate; callers typically build it from LiveNodeConfig::event_store inside the closure.

Source

pub fn with_external_msgbus_egress( self, external_egress: Box<dyn MessageBusExternalEgress>, ) -> Self

Inject external message bus egress for serialized message bus publications.

Source

pub fn with_external_msgbus_factory( self, factory: Box<dyn MessageBusBackingFactory>, ) -> Self

Build and inject external message bus egress and configured ingress from a factory.

Source

pub fn with_external_ingress( self, external_ingress: Box<dyn MessageBusExternalIngress>, ) -> Self

Inject external message bus ingress for serialized inbound publications.

Source

pub fn with_logging(self, logging: LoggerConfig) -> Self

Set the logging configuration.

Source

pub fn add_data_client( self, name: Option<String>, factory: Box<dyn DataClientFactory>, config: Box<dyn ClientConfig>, ) -> Result<Self>

Adds a data client factory with configuration.

§Errors

Returns an error if a client with the same name is already registered.

Source

pub fn add_data_client_with_routing( self, name: Option<String>, factory: Box<dyn DataClientFactory>, config: Box<dyn ClientConfig>, routing: RoutingConfig, ) -> Result<Self>

Adds a data client factory with configuration and explicit routing.

§Errors

Returns an error if a client with the same name is already registered.

Source

pub fn add_exec_client( self, name: Option<String>, factory: Box<dyn ExecutionClientFactory>, config: Box<dyn ClientConfig>, ) -> Result<Self>

Adds an execution client factory with configuration.

Equivalent to Self::add_exec_client_with_routing with default (empty) routing.

§Errors

Returns an error if a client with the same name is already registered.

Source

pub fn add_exec_client_with_routing( self, name: Option<String>, factory: Box<dyn ExecutionClientFactory>, config: Box<dyn ClientConfig>, routing: RoutingConfig, ) -> Result<Self>

Adds an execution client factory with configuration and explicit routing.

§Errors

Returns an error if a client with the same name is already registered.

Source

pub fn add_simulated_exec_client( self, name: Option<String>, factory: Box<dyn SimulatedExecutionClientFactory>, config: Box<dyn ClientConfig>, ) -> Result<Self>

Add a simulated execution client factory.

This path is for sync-core clients such as the sandbox matching engine, which owns cache mutation. Live venue adapters should use Self::add_exec_client.

§Errors

Returns an error if a client with the same name is already registered.

Source

pub fn build(self) -> Result<LiveNode>

Build the LiveNode with the configured settings.

This will:

  1. Build the underlying kernel.
  2. Create clients using factories.
  3. Register clients with engines.
§Errors

Returns an error if node construction fails.

Trait Implementations§

Source§

impl Debug for LiveNodeBuilder

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = 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.