pub struct Store { /* private fields */ }Expand description
The SQLite database, and every query the server makes against it.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Opens (creating if needed) the database at path.
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
An in-memory database, for tests.
Sourcepub fn get(
&self,
project_key: &str,
file_path: &str,
) -> Result<Option<Existing>>
pub fn get( &self, project_key: &str, file_path: &str, ) -> Result<Option<Existing>>
Reads one row.
Sourcepub fn upsert(
&self,
project_key: &str,
file_path: &str,
content: &str,
source_env: &str,
updated_at: &str,
) -> Result<()>
pub fn upsert( &self, project_key: &str, file_path: &str, content: &str, source_env: &str, updated_at: &str, ) -> Result<()>
Writes content, clearing any tombstone.
Sourcepub fn tombstone(
&self,
project_key: &str,
file_path: &str,
source_env: &str,
updated_at: &str,
) -> Result<()>
pub fn tombstone( &self, project_key: &str, file_path: &str, source_env: &str, updated_at: &str, ) -> Result<()>
Marks a file deleted while deliberately leaving its content in
place: a mistaken delete stays recoverable at the database level,
even though nothing in the app surfaces an undo yet. Store::list
withholds the content so a pull can’t resurrect it.
Sourcepub fn list(&self, project_key: &str) -> Result<Vec<File>>
pub fn list(&self, project_key: &str) -> Result<Vec<File>>
Every file for a project, tombstones included so a pulling client knows what to remove locally — but with the deleted content withheld.
Sourcepub fn last_sync_at(&self) -> Result<String>
pub fn last_sync_at(&self) -> Result<String>
The most recent write across all projects, for /health. Empty when
nothing has ever been synced.
Sourcepub fn admin_stats(&self) -> Result<(Vec<ProjectStats>, AdminTotals)>
pub fn admin_stats(&self) -> Result<(Vec<ProjectStats>, AdminTotals)>
Aggregates per project for the admin page.
Auto Trait Implementations§
impl !Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
impl UnwindSafe for Store
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