pub struct StandaloneServer;Expand description
Standalone d-engine server for independent deployment
Implementations§
Source§impl StandaloneServer
impl StandaloneServer
Sourcepub async fn run(shutdown_rx: Receiver<()>) -> Result<(), Error>
pub async fn run(shutdown_rx: Receiver<()>) -> Result<(), Error>
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(());
StandaloneServer::run(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(());
StandaloneServer::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(());
StandaloneServer::run_custom(storage, sm, shutdown_rx, Some("config.toml")).await?;Auto Trait Implementations§
impl Freeze for StandaloneServer
impl RefUnwindSafe for StandaloneServer
impl Send for StandaloneServer
impl Sync for StandaloneServer
impl Unpin for StandaloneServer
impl UnwindSafe for StandaloneServer
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