Skip to main content

AlbumStoreFile

Trait AlbumStoreFile 

Source
pub trait AlbumStoreFile: Sized {
    // Required methods
    fn path(root: &Path) -> PathBuf;
    fn load(
        root: &Path,
        master: &MasterKey,
    ) -> Result<Option<Self>, AlbumStoreError>;
    fn save(
        &self,
        root: &Path,
        master: &MasterKey,
    ) -> Result<(), AlbumStoreError>;
}
Expand description

Reading and durably replacing an [AlbumStore] on disk.

Required Methods§

Source

fn path(root: &Path) -> PathBuf

{root}/.library/albums.cbor.

Source

fn load( root: &Path, master: &MasterKey, ) -> Result<Option<Self>, AlbumStoreError>

Load and unseal the store at {root}/.library/albums.cbor.

Ok(None) means the file does not exist — a library written before album keys were durable, whose album keys were session-scoped and were therefore never persisted. Such a library opens with zero albums; its assets are recoverable only through a backup artifact (see Workspace::import_backup). This is not a regression — those assets were already undecryptable across a restart before the store existed — but it is a real, permanent limitation of libraries created before it.

Source

fn save(&self, root: &Path, master: &MasterKey) -> Result<(), AlbumStoreError>

Seal and durably replace the store. Temp-then-rename, so a crash mid-write leaves the previous good keystore intact rather than a truncated one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AlbumStoreFile for AlbumStore

Source§

fn path(root: &Path) -> PathBuf

Source§

fn load( root: &Path, master: &MasterKey, ) -> Result<Option<Self>, AlbumStoreError>

Source§

fn save(&self, root: &Path, master: &MasterKey) -> Result<(), AlbumStoreError>

Implementors§