feat(cms): implement RewindBlobRepository for managing binary blobs

This commit is contained in:
asepharyana
2026-07-17 09:08:41 +07:00
parent b272858edb
commit 22dd6fdda7
5 changed files with 205 additions and 0 deletions
@@ -63,6 +63,19 @@ pub trait MemoryRepository {
fn delete(&self, memory_dir: &Path, name: &str) -> Result<()>;
}
/// Repository for rewind-snapshot binary blobs, keyed by an arbitrary
/// caller-supplied key (e.g. a tool-call id) within a session.
pub trait RewindBlobRepository {
/// Store (or overwrite) a blob under `blob_key` for this session.
fn store_blob(&self, session_dir: &Path, blob_key: &str, data: &[u8], mime_type: Option<&str>) -> anyhow::Result<()>;
/// Retrieve a blob's bytes by key, or `None` if not found.
fn retrieve_blob(&self, session_dir: &Path, blob_key: &str) -> anyhow::Result<Option<Vec<u8>>>;
/// List all blob keys for this session, oldest first.
fn list_blob_keys(&self, session_dir: &Path) -> anyhow::Result<Vec<String>>;
}
/// Persistence contract for `EditLog`.
pub trait EditLogRepository {
/// Open (or start tracking) the edit log for a session directory.