1use crate::error::LagoResult;
2use crate::id::BlobHash;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ManifestEntry {
8 pub path: String,
9 pub blob_hash: BlobHash,
10 pub size_bytes: u64,
11 pub content_type: Option<String>,
12 pub updated_at: u64,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct FileStat {
18 pub path: String,
19 pub size_bytes: u64,
20 pub content_type: Option<String>,
21 pub updated_at: u64,
22 pub blob_hash: BlobHash,
23}
24
25#[allow(async_fn_in_trait)]
27pub trait Mount: Send + Sync {
28 async fn read(&self, path: &str) -> LagoResult<Vec<u8>>;
30
31 async fn write(&self, path: &str, data: &[u8]) -> LagoResult<BlobHash>;
33
34 async fn delete(&self, path: &str) -> LagoResult<()>;
36
37 async fn list(&self, path: &str) -> LagoResult<Vec<ManifestEntry>>;
39
40 async fn exists(&self, path: &str) -> LagoResult<bool>;
42
43 async fn stat(&self, path: &str) -> LagoResult<Option<FileStat>>;
45}