pub struct Store<'a> {
pub home: &'a Path,
pub lock: &'a Mutex<()>,
pub me: &'a Identity,
}Expand description
One node’s store as a session reads and writes it: where it is, the lock its writes take, and the
key that stamps its lines. Node stamps and merges through it alone; built over a store directly,
it does the same without an endpoint, for simulation and tests (tests/two_nodes_cli.rs), so they
run the merge a session runs.
Fields§
§home: &'a PathThe collective’s store.
lock: &'a Mutex<()>Serialises the writes to the store (Node’s, shared by the concurrent sessions of serve).
me: &'a IdentityThis node’s key: its own lines are stamped with it, and steering it receives admitted under it.
Implementations§
Source§impl Store<'_>
impl Store<'_>
Sourcepub fn stamp(&self) -> Result<usize, String>
pub fn stamp(&self) -> Result<usize, String>
Stamps the lines this node’s hooks wrote since the last call as its own (origin.rs).
Sourcepub fn store_lines(
&self,
path: &Path,
got: Vec<Signed>,
want: &BTreeSet<Hash>,
m: &Membership,
author: Option<&str>,
report: &mut Report,
) -> Result<(), String>
pub fn store_lines( &self, path: &Path, got: Vec<Signed>, want: &BTreeSet<Hash>, m: &Membership, author: Option<&str>, report: &mut Report, ) -> Result<(), String>
Stores the lines that were asked for, whose origin verifies and is admitted (and, for
replicas, is the peer itself), and that may travel under it (lines.rs travels): origin
records first, so a line is never re-stamped as ours.
Auto Trait Implementations§
impl<'a> Freeze for Store<'a>
impl<'a> RefUnwindSafe for Store<'a>
impl<'a> Send for Store<'a>
impl<'a> Sync for Store<'a>
impl<'a> Unpin for Store<'a>
impl<'a> UnsafeUnpin for Store<'a>
impl<'a> UnwindSafe for Store<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more