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