distributed_scheduler/driver/
mod.rs

1mod utils;
2
3#[cfg(feature = "driver-etcd")]
4/// Driver based on Etcd
5pub mod etcd;
6/// Driver based on local node only
7pub mod local;
8#[cfg(feature = "driver-redis")]
9/// Driver based on Redis Scan
10pub mod redis;
11#[cfg(feature = "driver-redis")]
12/// Driver based on Redis ZSet
13pub mod redis_zset;
14
15#[async_trait::async_trait]
16/// The driver trait, which defines the node list management interface.
17pub trait Driver {
18    type Error: std::error::Error + Send + Sync + 'static;
19
20    /// Get the local node id.
21    fn node_id(&self) -> String;
22    /// Get the node list in the cluster
23    async fn get_nodes(&self) -> Result<Vec<String>, Self::Error>;
24
25    /// Start the driver, blocking the current thread.
26    async fn start(&mut self) -> Result<(), Self::Error> {
27        Ok(())
28    }
29}