pub struct StandaloneEngine;Expand description
Standalone d-engine engine for independent deployment
Implementations§
Source§impl StandaloneEngine
impl StandaloneEngine
Sourcepub async fn run(shutdown_rx: Receiver<()>) -> Result<()>
pub async fn run(shutdown_rx: Receiver<()>) -> Result<()>
Run server with configuration from environment.
Reads CONFIG_PATH environment variable or uses default configuration.
Data directory is determined by config’s cluster.db_root_dir setting.
Blocks until shutdown signal is received.
§Arguments
shutdown_rx- Shutdown signal receiver
§Example
ⓘ
// Set config path via environment variable
std::env::set_var("CONFIG_PATH", "/etc/d-engine/production.toml");
let (shutdown_tx, shutdown_rx) = watch::channel(());
StandaloneEngine::run(shutdown_rx).await?;Sourcepub async fn run_with(
config_path: &str,
shutdown_rx: Receiver<()>,
) -> Result<()>
pub async fn run_with( config_path: &str, shutdown_rx: Receiver<()>, ) -> Result<()>
Run server with explicit configuration file.
Reads configuration from specified file path.
Data directory is determined by config’s cluster.db_root_dir setting.
Blocks until shutdown signal is received.
§Arguments
config_path- Path to configuration fileshutdown_rx- Shutdown signal receiver
§Example
ⓘ
let (shutdown_tx, shutdown_rx) = watch::channel(());
StandaloneEngine::run_with("config/node1.toml", shutdown_rx).await?;Sourcepub async fn run_custom<SE, SM>(
storage_engine: Arc<SE>,
state_machine: Arc<SM>,
shutdown_rx: Receiver<()>,
config_path: Option<&str>,
) -> Result<()>
pub async fn run_custom<SE, SM>( storage_engine: Arc<SE>, state_machine: Arc<SM>, shutdown_rx: Receiver<()>, config_path: Option<&str>, ) -> Result<()>
Run server with custom storage engine and state machine.
Advanced API for users providing custom storage implementations. Blocks until shutdown signal is received.
§Arguments
config- Node configurationstorage_engine- Custom storage engine implementationstate_machine- Custom state machine implementationshutdown_rx- Shutdown signal receiver
§Example
ⓘ
let storage = Arc::new(MyCustomStorage::new()?);
let sm = Arc::new(MyCustomStateMachine::new()?);
let (shutdown_tx, shutdown_rx) = watch::channel(());
StandaloneEngine::run_custom(storage, sm, shutdown_rx, Some("config.toml")).await?;Auto Trait Implementations§
impl Freeze for StandaloneEngine
impl RefUnwindSafe for StandaloneEngine
impl Send for StandaloneEngine
impl Sync for StandaloneEngine
impl Unpin for StandaloneEngine
impl UnsafeUnpin for StandaloneEngine
impl UnwindSafe for StandaloneEngine
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request