pub struct NautilusKernelBuilder { /* private fields */ }Expand description
Builder for constructing a NautilusKernel with a fluent API.
Provides a convenient way to configure and build a kernel instance with optional components and settings.
Implementations§
Source§impl NautilusKernelBuilder
impl NautilusKernelBuilder
Sourcepub const fn new(
name: String,
trader_id: TraderId,
environment: Environment,
) -> Self
pub const fn new( name: String, trader_id: TraderId, environment: Environment, ) -> Self
Creates a new NautilusKernelBuilder with required parameters.
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 kernel.
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 const fn with_shutdown_on_error(self, shutdown_on_error: bool) -> Self
pub const fn with_shutdown_on_error(self, shutdown_on_error: bool) -> Self
Configure whether an error log shuts down the system.
Filtered or bypassed error logs still request shutdown.
Sourcepub fn with_logging_config(self, config: LoggerConfig) -> Self
pub fn with_logging_config(self, config: LoggerConfig) -> Self
Set the logging configuration.
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 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(self, timeout_secs: u64) -> Self
pub const fn with_timeout_disconnection(self, timeout_secs: u64) -> Self
Set the disconnection timeout in seconds.
Sourcepub const fn with_delay_post_stop(self, delay_secs: u64) -> Self
pub const fn with_delay_post_stop(self, delay_secs: u64) -> Self
Set the post-stop delay in seconds.
Sourcepub const fn with_timeout_shutdown(self, timeout_secs: u64) -> Self
pub const fn with_timeout_shutdown(self, timeout_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.
The factory is invoked for the kernel clock and once per registered component. Each
invocation should return a fresh instance. Without a factory, live/sandbox systems use
LiveClock::default().
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(self, adapter: Box<dyn CacheDatabaseAdapter>) -> Self
pub fn with_cache_database(self, adapter: Box<dyn CacheDatabaseAdapter>) -> Self
Inject a durable cache database adapter.
The adapter is passed straight to [nautilus_common::cache::Cache::new] so
generic cache state (including event-store snapshot blobs) is restored on
startup without an external caller pre-seeding the in-memory cache. Adapter
construction lives outside this crate to keep nautilus-system decoupled
from concrete backing stores such as Redis or Postgres.
Sourcepub fn with_data_engine_config(self, config: DataEngineConfig) -> Self
pub fn with_data_engine_config(self, config: DataEngineConfig) -> Self
Set the data engine configuration.
Sourcepub fn with_risk_engine_config(self, config: RiskEngineConfig) -> Self
pub fn with_risk_engine_config(self, config: RiskEngineConfig) -> Self
Set the risk engine configuration.
Sourcepub fn with_exec_engine_config(self, config: ExecutionEngineConfig) -> Self
pub fn with_exec_engine_config(self, config: ExecutionEngineConfig) -> Self
Set the execution engine configuration.
Sourcepub const fn with_portfolio_config(self, config: PortfolioConfig) -> Self
pub const fn with_portfolio_config(self, config: PortfolioConfig) -> Self
Set the portfolio configuration.
Sourcepub fn with_msgbus_config(self, config: MessageBusConfig) -> Self
pub fn with_msgbus_config(self, config: MessageBusConfig) -> Self
Set the message bus configuration.
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 is invoked with the kernel’s instance id and clock during
construction, so the returned KernelEventStore scans the same run directory
and shares the same time source the kernel uses for RunStarted/RunEnded and
any drop-seal fallback. The concrete implementation lives outside this crate
(typically in nautilus-event-store); callers build it 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 from a factory.
Sourcepub fn build(self) -> Result<NautilusKernel>
pub fn build(self) -> Result<NautilusKernel>
Build the NautilusKernel with the configured settings.
§Errors
Returns an error if kernel initialization fails.
Trait Implementations§
Source§impl Debug for NautilusKernelBuilder
impl Debug for NautilusKernelBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for NautilusKernelBuilder
impl !Send for NautilusKernelBuilder
impl !Sync for NautilusKernelBuilder
impl !UnwindSafe for NautilusKernelBuilder
impl Freeze for NautilusKernelBuilder
impl Unpin for NautilusKernelBuilder
impl UnsafeUnpin for NautilusKernelBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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