distributed_scheduler/driver/
local.rs

1use std::{convert::Infallible, fmt::Debug};
2
3use super::Driver;
4
5const LOCAL_NODE_ID: &str = "local";
6
7#[derive(Clone, Debug)]
8pub struct LocalDriver;
9
10#[async_trait::async_trait]
11impl Driver for LocalDriver {
12    type Error = Infallible;
13
14    fn node_id(&self) -> String {
15        LOCAL_NODE_ID.to_string()
16    }
17
18    /// Scan the redis server to get the nodes
19    async fn get_nodes(&self) -> Result<Vec<String>, Self::Error> {
20        Ok(vec![LOCAL_NODE_ID.to_string()])
21    }
22}