pub struct StandaloneEngine;Expand description
Standalone d-engine engine for independent deployment
Implementations§
Source§impl StandaloneEngine
impl StandaloneEngine
Sourcepub async fn run(
data_dir: impl AsRef<Path>,
shutdown_rx: Receiver<()>,
) -> Result<(), Error>
pub async fn run( data_dir: impl AsRef<Path>, shutdown_rx: Receiver<()>, ) -> Result<(), Error>
Run server with an explicit data directory.
data_dir has highest priority and always overrides cluster.db_root_dir from
CONFIG_PATH or RAFT__ environment variables. Other configuration (network,
Raft timeouts, cluster topology) is still read from those sources if set.
The directory is created automatically if it does not exist. Blocks until shutdown signal is received.
§Arguments
data_dir- Path to the data directoryshutdown_rx- Shutdown signal receiver
§Example
let (shutdown_tx, shutdown_rx) = watch::channel(());
StandaloneEngine::run("./data/my-node", shutdown_rx).await?;Sourcepub async fn run_with(
config_path: &str,
shutdown_rx: Receiver<()>,
) -> Result<(), Error>
pub async fn run_with( config_path: &str, shutdown_rx: Receiver<()>, ) -> Result<(), Error>
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<(), Error>
pub async fn run_custom<SE, SM>( storage_engine: Arc<SE>, state_machine: Arc<SM>, shutdown_rx: Receiver<()>, config_path: Option<&str>, ) -> Result<(), Error>
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
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>
T in a tonic::Request