Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }
Expand description

The server’s files. Clones share the same folder.

Implementations§

Source§

impl Store

Source

pub fn open(root: &Path) -> Result<Self>

Opens the store, creating its folders.

Source

pub fn layouts(&self) -> Result<Vec<String>>

The names of the stored layouts.

Source

pub fn layout_versions(&self, name: &str) -> Result<Vec<LayoutVersion>>

A layout’s versions, oldest first.

Source

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.

Source

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.

Source

pub fn delete_layout(&self, name: &str) -> Result<bool>

Deletes a layout and all its versions. Returns whether it existed.

Source

pub fn job_ids(&self) -> Result<Vec<String>>

The ids of the stored jobs.

Source

pub fn save_job(&self, id: &str, job: &Job) -> Result<()>

Saves a job. Its next run is computed again.

Source

pub fn job(&self, id: &str) -> Result<Option<Job>>

A job by id.

Source

pub fn delete_job(&self, id: &str) -> Result<bool>

Deletes a job, with its history and kept documents. Returns whether it existed.

Source

pub fn job_state(&self, id: &str) -> Result<JobState>

A job’s schedule state.

Source

pub fn save_job_state(&self, id: &str, state: &JobState) -> Result<()>

Saves a job’s schedule state.

Source

pub fn new_run_id(&self, now: Timestamp) -> String

A new run id, later than the ones before it.

Source

pub fn save_run(&self, run: &RunRecord, limit: usize) -> Result<()>

Adds a run to a job’s history, dropping the oldest past limit.

Source

pub fn runs(&self, job: &str, limit: usize) -> Result<Vec<RunRecord>>

A job’s runs, newest first, at most limit.

Source

pub fn run(&self, job: &str, id: &str) -> Result<Option<RunRecord>>

One run of a job.

Source

pub fn save_document( &self, job: &str, run: &str, file: &str, bytes: &[u8], ) -> Result<()>

Keeps a run’s file on the server.

Source

pub fn document( &self, job: &str, run: &str, file: &str, ) -> Result<Option<Vec<u8>>>

A kept file.

Source

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.

Trait Implementations§

Source§

impl Clone for Store

Source§

fn clone(&self) -> Store

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more