conduit_cli/core/engine/
mod.rs1pub mod archive;
2pub mod downloader;
3pub mod io;
4pub mod manager;
5pub mod resolver;
6pub mod store;
7pub mod workflow;
8
9use crate::core::api::ConduitAPI;
10use crate::core::engine::downloader::Downloader;
11use crate::core::engine::resolver::Resolver;
12use crate::core::engine::store::Store;
13use crate::core::schemas::include::ConduitInclude;
14use crate::core::schemas::lock::Lockfile;
15use crate::core::schemas::manifest::Manifest;
16use crate::paths::ConduitPaths;
17use std::sync::Arc;
18use tokio::sync::RwLock;
19
20pub struct ConduitContext {
21 pub api: Arc<ConduitAPI>,
22 pub store: Arc<Store>,
23 pub downloader: Arc<Downloader>,
24 pub resolver: Arc<Resolver>,
25 pub manifest: RwLock<Manifest>,
26 pub lockfile: RwLock<Lockfile>,
27 pub includefile: RwLock<ConduitInclude>,
28 pub paths: ConduitPaths,
29}
30
31impl ConduitContext {
32 pub fn new(
33 paths: ConduitPaths,
34 manifest: Manifest,
35 lockfile: Lockfile,
36 includefile: ConduitInclude,
37 ) -> Self {
38 let api = Arc::new(ConduitAPI::new());
39 let store = Arc::new(Store::new(paths.clone().store));
40 let downloader = Arc::new(Downloader::new(store.clone()));
41 let resolver = Arc::new(Resolver::new(api.clone()));
42
43 Self {
44 api,
45 store,
46 downloader,
47 resolver,
48 manifest: RwLock::new(manifest),
49 lockfile: RwLock::new(lockfile),
50 includefile: RwLock::new(includefile),
51 paths,
52 }
53 }
54}