secure_exec_vfs_core/engine/
metadata.rs1use crate::engine::error::VfsResult;
2use crate::engine::types::{
3 BlockKey, ChunkEdit, ChunkRange, ChunkRef, CreateInodeAttrs, DentryStat, InodeMeta, InodePatch,
4 SnapshotId,
5};
6use async_trait::async_trait;
7
8#[async_trait]
9pub trait MetadataStore: Send + Sync {
10 async fn resolve(&self, path: &str) -> VfsResult<InodeMeta>;
11 async fn resolve_parent(&self, path: &str) -> VfsResult<(InodeMeta, String)>;
12 async fn lstat(&self, path: &str) -> VfsResult<InodeMeta>;
13 async fn list_dir(&self, ino: u64) -> VfsResult<Vec<DentryStat>>;
14
15 async fn create(
16 &self,
17 parent: u64,
18 name: &str,
19 attrs: CreateInodeAttrs,
20 ) -> VfsResult<InodeMeta>;
21 async fn link(&self, parent: u64, name: &str, target: u64) -> VfsResult<()>;
22 async fn remove(&self, parent: u64, name: &str) -> VfsResult<Vec<BlockKey>>;
23 async fn rename(
24 &self,
25 src_parent: u64,
26 src: &str,
27 dst_parent: u64,
28 dst: &str,
29 ) -> VfsResult<Vec<BlockKey>>;
30 async fn set_attr(&self, ino: u64, patch: InodePatch) -> VfsResult<Vec<BlockKey>>;
31 async fn commit_write(
32 &self,
33 ino: u64,
34 edits: Vec<ChunkEdit>,
35 new_size: u64,
36 ) -> VfsResult<Vec<BlockKey>>;
37
38 async fn get_chunks(&self, ino: u64, range: ChunkRange) -> VfsResult<Vec<ChunkRef>>;
39
40 async fn snapshot(&self, root: u64) -> VfsResult<SnapshotId>;
41 async fn fork(&self, snap: SnapshotId) -> VfsResult<u64>;
42 async fn gc(&self) -> VfsResult<Vec<BlockKey>>;
43}