Skip to main content

NautilusKernelBuilder

Struct NautilusKernelBuilder 

Source
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

Source

pub const fn new( name: String, trader_id: TraderId, environment: Environment, ) -> Self

Creates a new NautilusKernelBuilder with required parameters.

Source

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

Set the instance ID for the kernel.

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

Source

pub fn with_logging_config(self, config: LoggerConfig) -> Self

Set the logging configuration.

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 const fn with_timeout_portfolio(self, timeout_secs: u64) -> Self

Set the portfolio initialization timeout in seconds.

Source

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

Set the disconnection timeout in seconds.

Source

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

Set the post-stop delay in seconds.

Source

pub const fn with_timeout_shutdown(self, timeout_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.

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().

Source

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

Set the cache configuration.

Source

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.

Source

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

Set the data engine configuration.

Source

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

Set the risk engine configuration.

Source

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

Set the execution engine configuration.

Source

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

Set the portfolio configuration.

Source

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

Set the message bus configuration.

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

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 from a factory.

Source

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

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for NautilusKernelBuilder

Source§

fn default() -> Self

Create a default builder with minimal configuration for testing/development.

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
§

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

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more