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