pub struct LiveNode { /* private fields */ }
Expand description
High-level abstraction for a live Posei system node.
Provides a simplified interface for running live systems with automatic client management and lifecycle handling.
Implementations§
Source§impl LiveNode
impl LiveNode
Sourcepub fn builder(
name: String,
trader_id: TraderId,
environment: Environment,
) -> Result<LiveNodeBuilder>
pub fn builder( name: String, trader_id: TraderId, environment: Environment, ) -> Result<LiveNodeBuilder>
Creates a new LiveNodeBuilder
for fluent configuration.
§Errors
Returns an error if the environment is invalid for live trading.
Sourcepub fn build(name: String, config: Option<LiveNodeConfig>) -> Result<Self>
pub fn build(name: String, config: Option<LiveNodeConfig>) -> Result<Self>
Creates a new LiveNode
directly from a kernel name and optional configuration.
This is a convenience method for creating a live node with a pre-configured kernel configuration, bypassing the builder pattern. If no config is provided, a default configuration will be used.
§Errors
Returns an error if kernel construction fails.
Sourcepub async fn run_async(&mut self) -> Result<()>
pub async fn run_async(&mut self) -> Result<()>
Run the live node with automatic shutdown handling.
This method will start the node, run indefinitely, and handle graceful shutdown on interrupt signals.
§Errors
Returns an error if the node fails to start or encounters a runtime error.
Sourcepub fn environment(&self) -> Environment
pub fn environment(&self) -> Environment
Gets the node’s environment.
Sourcepub const fn instance_id(&self) -> UUID4
pub const fn instance_id(&self) -> UUID4
Gets the node’s instance ID.
Sourcepub const fn is_running(&self) -> bool
pub const fn is_running(&self) -> bool
Checks if the live node is currently running.
Sourcepub fn add_actor(&mut self, actor: Box<dyn Component>) -> Result<()>
pub fn add_actor(&mut self, actor: Box<dyn Component>) -> Result<()>
Adds an actor to the trader.
This method provides a high-level interface for adding actors to the underlying trader without requiring direct access to the kernel. Actors should be added after the node is built but before starting the node.
§Errors
Returns an error if:
- The trader is not in a valid state for adding components.
- An actor with the same ID is already registered.
- The node is currently running.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LiveNode
impl !RefUnwindSafe for LiveNode
impl !Send for LiveNode
impl !Sync for LiveNode
impl Unpin for LiveNode
impl !UnwindSafe for LiveNode
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<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