pub struct Store { /* private fields */ }Expand description
The server’s files. Clones share the same folder.
Implementations§
Source§impl Store
impl Store
Sourcepub fn layout_versions(&self, name: &str) -> Result<Vec<LayoutVersion>>
pub fn layout_versions(&self, name: &str) -> Result<Vec<LayoutVersion>>
A layout’s versions, oldest first.
Sourcepub fn save_layout(&self, name: &str, json: &str) -> Result<u32>
pub fn save_layout(&self, name: &str, json: &str) -> Result<u32>
Saves a layout. Saving what the latest version already holds adds no version. Returns the version that holds it.
Sourcepub fn layout(
&self,
name: &str,
version: Option<u32>,
) -> Result<Option<(u32, String)>>
pub fn layout( &self, name: &str, version: Option<u32>, ) -> Result<Option<(u32, String)>>
A layout’s text with its version: the latest, or the one asked for.
Sourcepub fn delete_layout(&self, name: &str) -> Result<bool>
pub fn delete_layout(&self, name: &str) -> Result<bool>
Deletes a layout and all its versions. Returns whether it existed.
Sourcepub fn save_job(&self, id: &str, job: &Job) -> Result<()>
pub fn save_job(&self, id: &str, job: &Job) -> Result<()>
Saves a job. Its next run is computed again.
Sourcepub fn delete_job(&self, id: &str) -> Result<bool>
pub fn delete_job(&self, id: &str) -> Result<bool>
Deletes a job, with its history and kept documents. Returns whether it existed.
Sourcepub fn save_job_state(&self, id: &str, state: &JobState) -> Result<()>
pub fn save_job_state(&self, id: &str, state: &JobState) -> Result<()>
Saves a job’s schedule state.
Sourcepub fn new_run_id(&self, now: Timestamp) -> String
pub fn new_run_id(&self, now: Timestamp) -> String
A new run id, later than the ones before it.
Sourcepub fn save_run(&self, run: &RunRecord, limit: usize) -> Result<()>
pub fn save_run(&self, run: &RunRecord, limit: usize) -> Result<()>
Adds a run to a job’s history, dropping the oldest past limit.
Sourcepub fn runs(&self, job: &str, limit: usize) -> Result<Vec<RunRecord>>
pub fn runs(&self, job: &str, limit: usize) -> Result<Vec<RunRecord>>
A job’s runs, newest first, at most limit.
Sourcepub fn save_document(
&self,
job: &str,
run: &str,
file: &str,
bytes: &[u8],
) -> Result<()>
pub fn save_document( &self, job: &str, run: &str, file: &str, bytes: &[u8], ) -> Result<()>
Keeps a run’s file on the server.
Sourcepub fn document(
&self,
job: &str,
run: &str,
file: &str,
) -> Result<Option<Vec<u8>>>
pub fn document( &self, job: &str, run: &str, file: &str, ) -> Result<Option<Vec<u8>>>
A kept file.
Sourcepub fn purge_documents(&self, job: &str, cutoff: Timestamp) -> Result<usize>
pub fn purge_documents(&self, job: &str, cutoff: Timestamp) -> Result<usize>
Deletes a job’s kept files older than cutoff. Returns how many runs lost theirs.