pub struct ManifestStore { /* private fields */ }Expand description
Manifest persistence helpers.
Separated from event_log so the hot append path does not carry
serialization concerns, and so open can cheaply probe the manifest
before deciding whether to run the O(n) scan.
Implementations§
Source§impl ManifestStore
impl ManifestStore
Sourcepub fn new(session_dir: PathBuf) -> Self
pub fn new(session_dir: PathBuf) -> Self
Create a new manifest store for the given session directory.
Sourcepub fn manifest_path(&self) -> PathBuf
pub fn manifest_path(&self) -> PathBuf
Path to manifest.json inside the session directory.
Sourcepub fn turns_path(&self) -> PathBuf
pub fn turns_path(&self) -> PathBuf
Path to index/turns.json inside the session directory.
Sourcepub fn load_manifest(
&self,
) -> Result<Option<SessionManifest>, SessionStoreError>
pub fn load_manifest( &self, ) -> Result<Option<SessionManifest>, SessionStoreError>
Load the manifest if it exists and is parseable.
Returns Ok(None) when the file is missing (fresh session) or
unreadable, rather than erroring — the caller can fall back to
scanning the event log.
Sourcepub fn load_turn_index(&self) -> Result<Option<TurnIndex>, SessionStoreError>
pub fn load_turn_index(&self) -> Result<Option<TurnIndex>, SessionStoreError>
Load the turn index if it exists and is parseable.
Returns Ok(None) when the file is missing or unreadable.
Sourcepub fn write_manifest(
&self,
manifest: &SessionManifest,
) -> Result<(), SessionStoreError>
pub fn write_manifest( &self, manifest: &SessionManifest, ) -> Result<(), SessionStoreError>
Atomically write the manifest. Parent directories must already exist.
Sourcepub fn write_turn_index(
&self,
index: &TurnIndex,
) -> Result<(), SessionStoreError>
pub fn write_turn_index( &self, index: &TurnIndex, ) -> Result<(), SessionStoreError>
Atomically write the turn index. Parent directories must already exist.