1use async_trait::async_trait;
4use tracing::instrument;
5
6use cellos_core::ports::{CellBackend, CellHandle, TeardownReport};
7use cellos_core::{CellosError, ExecutionCellDocument};
8
9pub struct StubCellBackend;
11
12#[async_trait]
13impl CellBackend for StubCellBackend {
14 #[instrument(skip(self, spec))]
15 async fn create(&self, spec: &ExecutionCellDocument) -> Result<CellHandle, CellosError> {
16 if spec.spec.id.is_empty() {
17 return Err(CellosError::InvalidSpec("spec.id must be non-empty".into()));
18 }
19 Ok(CellHandle {
20 cell_id: spec.spec.id.clone(),
21 cgroup_path: None,
22 nft_rules_applied: None,
25 kernel_digest_sha256: None,
27 rootfs_digest_sha256: None,
28 firecracker_digest_sha256: None,
29 })
30 }
31
32 #[instrument(skip(self, handle))]
33 async fn destroy(&self, handle: &CellHandle) -> Result<TeardownReport, CellosError> {
34 Ok(TeardownReport {
35 cell_id: handle.cell_id.clone(),
36 destroyed: true,
37 peers_tracked_after: 0,
38 })
39 }
40}