Skip to main content

Store

Struct Store 

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

The task store of one project directory.

Implementations§

Source§

impl Store

Source

pub fn new(dir: impl Into<PathBuf>) -> Self

The store in dir (created on the first write).

Source

pub fn dir(&self) -> &Path

Source

pub fn load(&self) -> Result<Board, TaskError>

The board as written (an empty one before the first write).

Source

pub fn read( &self, now: DateTime<Utc>, ) -> Result<(Board, Vec<Change>), TaskError>

The board as of now: claims that ran out are given back first (a write), and their changes returned for the caller’s notices.

Source

pub fn write<T>( &self, now: DateTime<Utc>, change: impl FnOnce(&mut Board) -> Result<T, TaskError>, ) -> Result<(T, Vec<Change>), TaskError>

Change the board under both locks. Claims that ran out by now are given back before change runs. Returns what change returned and every change recorded in this write (expiries first), for notices.

Source

pub fn read_announced( &self, now: DateTime<Utc>, post: impl FnOnce(&[Change]) -> bool, ) -> Result<(Board, Vec<Change>), TaskError>

Store::read, then announce every transition the bus has not taken yet (see Store::write_announced).

Source

pub fn write_announced<T>( &self, now: DateTime<Utc>, change: impl FnOnce(&mut Board) -> Result<T, TaskError>, post: impl FnOnce(&[Change]) -> bool, ) -> Result<(T, Vec<Change>), TaskError>

Store::write, then post the transitions the bus has not taken yet: this write’s and any an earlier failed post left behind (from the journal). post runs after both locks are released, so a slow or contended bus never holds up the next task writer. It returns whether the bus took the notices; only then does the cursor (notices.json) move past them, so a failed bus write is retried on the next access instead of being lost (Hive task #39). Notices are keyed by their journal sequence, so a re-post is idempotent.

Source

pub fn journal(&self) -> Vec<Transition>

The journal, oldest first (a line that does not parse is skipped).

Trait Implementations§

Source§

impl Clone for Store

Source§

fn clone(&self) -> Self

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 Forget for Store

§

impl Freeze for Store

§

impl Move 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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.