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
impl LiveNodeBuilder
Sourcepub fn new(trader_id: TraderId, environment: Environment) -> Result<Self>
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).
Sourcepub fn from_config(config: LiveNodeConfig) -> Result<Self>
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).
Sourcepub const fn with_instance_id(self, instance_id: UUID4) -> Self
pub const fn with_instance_id(self, instance_id: UUID4) -> Self
Set the instance ID for the node.
Sourcepub const fn with_load_state(self, load_state: bool) -> Self
pub const fn with_load_state(self, load_state: bool) -> Self
Configure whether to load state on startup.
Sourcepub const fn with_save_state(self, save_state: bool) -> Self
pub const fn with_save_state(self, save_state: bool) -> Self
Configure whether to save state on shutdown.
Sourcepub fn with_controller(self, controller: ImportableControllerConfig) -> Self
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.
Sourcepub const fn with_timeout_connection(self, timeout_secs: u64) -> Self
pub const fn with_timeout_connection(self, timeout_secs: u64) -> Self
Set the connection timeout in seconds.
Sourcepub const fn with_timeout_reconciliation(self, timeout_secs: u64) -> Self
pub const fn with_timeout_reconciliation(self, timeout_secs: u64) -> Self
Set the reconciliation timeout in seconds.
Sourcepub fn with_reconciliation(self, reconciliation: bool) -> Self
pub fn with_reconciliation(self, reconciliation: bool) -> Self
Configure whether to run startup reconciliation.
Sourcepub fn with_reconciliation_lookback_mins(self, mins: u32) -> Self
pub fn with_reconciliation_lookback_mins(self, mins: u32) -> Self
Set the reconciliation lookback in minutes.
Sourcepub const fn with_timeout_portfolio(self, timeout_secs: u64) -> Self
pub const fn with_timeout_portfolio(self, timeout_secs: u64) -> Self
Set the portfolio initialization timeout in seconds.
Sourcepub const fn with_timeout_disconnection_secs(self, timeout_secs: u64) -> Self
pub const fn with_timeout_disconnection_secs(self, timeout_secs: u64) -> Self
Set the disconnection timeout in seconds.
Sourcepub const fn with_delay_post_stop_secs(self, delay_secs: u64) -> Self
pub const fn with_delay_post_stop_secs(self, delay_secs: u64) -> Self
Set the post-stop delay in seconds.
Sourcepub const fn with_delay_shutdown_secs(self, delay_secs: u64) -> Self
pub const fn with_delay_shutdown_secs(self, delay_secs: u64) -> Self
Set the shutdown timeout in seconds.
Sourcepub fn with_clock_factory<F>(self, factory: F) -> Self
pub fn with_clock_factory<F>(self, factory: F) -> Self
Inject a caller-supplied clock factory for the kernel and component clocks.
Sourcepub fn with_cache_config(self, config: CacheConfig) -> Self
pub fn with_cache_config(self, config: CacheConfig) -> Self
Set the cache configuration.
Sourcepub fn with_cache_database_factory(
self,
factory: Box<dyn CacheDatabaseFactory>,
) -> Self
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.
Sourcepub fn with_msgbus_config(self, config: MessageBusConfig) -> Self
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.
Sourcepub fn with_portfolio_config(self, config: PortfolioConfig) -> Self
pub fn with_portfolio_config(self, config: PortfolioConfig) -> Self
Set the portfolio configuration.
Sourcepub fn with_streaming_config(self, config: StreamingConfig) -> Self
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.
Sourcepub fn with_data_engine_config(self, config: LiveDataEngineConfig) -> Self
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.
Sourcepub fn with_risk_engine_config(self, config: LiveRiskEngineConfig) -> Self
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.
Sourcepub fn with_exec_engine_config(self, config: LiveExecEngineConfig) -> Self
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.
Sourcepub fn with_event_store<F>(self, factory: F) -> Self
pub fn with_event_store<F>(self, factory: F) -> Self
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.
Sourcepub fn with_external_msgbus_egress(
self,
external_egress: Box<dyn MessageBusExternalEgress>,
) -> Self
pub fn with_external_msgbus_egress( self, external_egress: Box<dyn MessageBusExternalEgress>, ) -> Self
Inject external message bus egress for serialized message bus publications.
Sourcepub fn with_external_msgbus_factory(
self,
factory: Box<dyn MessageBusBackingFactory>,
) -> Self
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.
Sourcepub fn with_external_ingress(
self,
external_ingress: Box<dyn MessageBusExternalIngress>,
) -> Self
pub fn with_external_ingress( self, external_ingress: Box<dyn MessageBusExternalIngress>, ) -> Self
Inject external message bus ingress for serialized inbound publications.
Sourcepub fn with_logging(self, logging: LoggerConfig) -> Self
pub fn with_logging(self, logging: LoggerConfig) -> Self
Set the logging configuration.
Sourcepub fn add_data_client(
self,
name: Option<String>,
factory: Box<dyn DataClientFactory>,
config: Box<dyn ClientConfig>,
) -> Result<Self>
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.
Sourcepub fn add_data_client_with_routing(
self,
name: Option<String>,
factory: Box<dyn DataClientFactory>,
config: Box<dyn ClientConfig>,
routing: RoutingConfig,
) -> Result<Self>
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.
Sourcepub fn add_exec_client(
self,
name: Option<String>,
factory: Box<dyn ExecutionClientFactory>,
config: Box<dyn ClientConfig>,
) -> Result<Self>
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.
Sourcepub fn add_exec_client_with_routing(
self,
name: Option<String>,
factory: Box<dyn ExecutionClientFactory>,
config: Box<dyn ClientConfig>,
routing: RoutingConfig,
) -> Result<Self>
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.
Sourcepub fn add_simulated_exec_client(
self,
name: Option<String>,
factory: Box<dyn SimulatedExecutionClientFactory>,
config: Box<dyn ClientConfig>,
) -> Result<Self>
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.