1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* use std::{
collections::HashMap,
path::{Path, PathBuf},
};
use dashmap::DashMap;
use tokio::sync::RwLock;
use crate::{config::AutoschematicConfig, connector_cache::ConnectorCache};
#[derive(Default)]
pub struct ConnectorTaskRegistryEntry {
pub addr: PathBuf,
pub body: Vec<u8>,
pub arg: Option<Vec<u8>>,
pub state: Option<Vec<u8>>,
pub modified_files: Option<Vec<PathBuf>>,
pub outputs: Option<HashMap<String, Option<String>>>,
pub secrets: Option<HashMap<PathBuf, Option<String>>>,
pub friendly_messages: Option<Vec<String>>,
pub delay_until: Option<u32>,
}
#[derive(Default)]
pub struct ConnectorTaskRegistry {
// connector_cache: ConnectorCache,
pub entries: DashMap<String, RwLock<ConnectorTaskRegistryEntry>>,
}
impl ConnectorTaskRegistry {
pub async fn init(&self) {}
pub async fn start_task(
config: &AutoschematicConfig,
connector_cache: &ConnectorCache,
prefix: &str,
addr: &Path,
arg: Vec<u8>,
) -> () {
// TODO ok so here, we'll go through every connector in the config,
// spawn or get it,
// and then get which ever connector returns FilterResponse::Task.
// Then, we'll spawn a tokio thread that will loop,
// and every iteration, it will run Connector::task_exec.
// these tokio task handles will have to be stored in the registry too lol
// kill on drop etc
//
}
}
*/