Skip to main content

libpetri_debug/archive/
session_archive_storage.rs

1//! Storage backend trait for session archives.
2
3/// Summary of an archived session in storage.
4#[derive(Debug, Clone)]
5pub struct ArchivedSessionSummary {
6    pub session_id: String,
7    pub key: String,
8    pub size_bytes: u64,
9    /// Epoch milliseconds.
10    pub last_modified: u64,
11}
12
13/// Storage backend interface for session archives.
14pub trait SessionArchiveStorage: Send + Sync {
15    /// Stores a compressed archive for the given session.
16    fn store(&self, session_id: &str, data: &[u8]) -> Result<(), String>;
17
18    /// Lists archived sessions, most recent first.
19    fn list(
20        &self,
21        limit: usize,
22        prefix: Option<&str>,
23    ) -> Result<Vec<ArchivedSessionSummary>, String>;
24
25    /// Retrieves the compressed archive data for a session.
26    fn retrieve(&self, session_id: &str) -> Result<Vec<u8>, String>;
27
28    /// Returns `true` if the storage backend is available.
29    fn is_available(&self) -> bool;
30}