pub struct FileStore { /* private fields */ }Expand description
File-based storage backend.
Stores each principal’s entries in a JSONL file named <pr_b64>.jsonl
within the configured base directory.
§Example
use cyphr_storage::FileStore;
let store = FileStore::new("/var/data/cyphr");Implementations§
Source§impl FileStore
impl FileStore
Sourcepub fn append_commit(
&self,
pr: &PrincipalGenesis,
commit: &CommitEntry,
) -> Result<(), FileStoreError>
pub fn append_commit( &self, pr: &PrincipalGenesis, commit: &CommitEntry, ) -> Result<(), FileStoreError>
Append a commit bundle to the principal’s log.
Each commit is stored as a single JSON line containing:
cozies: Array of coz entriescommit_id: Commit ID (base64url)as: Auth State (base64url)sr: State Root (base64url)ps: Principal State (base64url)
Sourcepub fn get_commits(
&self,
pr: &PrincipalGenesis,
) -> Result<Vec<CommitEntry>, FileStoreError>
pub fn get_commits( &self, pr: &PrincipalGenesis, ) -> Result<Vec<CommitEntry>, FileStoreError>
Get all commits from the principal’s log.
Parses each line as a CommitEntry with embedded state digests.
Trait Implementations§
Source§impl Store for FileStore
impl Store for FileStore
Source§type Error = FileStoreError
type Error = FileStoreError
The error type for this store implementation.
Source§fn append_entry(
&self,
pr: &PrincipalGenesis,
entry: &Entry,
) -> Result<(), Self::Error>
fn append_entry( &self, pr: &PrincipalGenesis, entry: &Entry, ) -> Result<(), Self::Error>
Append a signed entry to the log.
Source§fn get_entries(&self, pr: &PrincipalGenesis) -> Result<Vec<Entry>, Self::Error>
fn get_entries(&self, pr: &PrincipalGenesis) -> Result<Vec<Entry>, Self::Error>
Retrieve all entries for a principal.
Source§fn get_entries_range(
&self,
pr: &PrincipalGenesis,
opts: &QueryOpts,
) -> Result<Vec<Entry>, Self::Error>
fn get_entries_range( &self, pr: &PrincipalGenesis, opts: &QueryOpts, ) -> Result<Vec<Entry>, Self::Error>
Retrieve entries with filtering (supports coz patches).
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
impl UnwindSafe for FileStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more