pub struct RecordStatus {
pub hosts: HashMap<HostId, HashMap<String, RecordIdx>>,
}
Expand description
An index representing the current state of the record stores This can be both remote, or local, and compared in either direction
Fields§
§hosts: HashMap<HostId, HashMap<String, RecordIdx>>
Implementations§
Source§impl RecordStatus
impl RecordStatus
pub fn new() -> RecordStatus
Sourcepub fn set(&mut self, tail: Record<DecryptedData>)
pub fn set(&mut self, tail: Record<DecryptedData>)
Insert a new tail record into the store
pub fn set_raw(&mut self, host: HostId, tag: String, tail_id: RecordIdx)
pub fn get(&self, host: HostId, tag: String) -> Option<RecordIdx>
Sourcepub fn diff(&self, other: &Self) -> Vec<Diff>
pub fn diff(&self, other: &Self) -> Vec<Diff>
Diff this index with another, likely remote index. The two diffs can then be reconciled, and the optimal change set calculated Returns a tuple, with (host, tag, Option(OTHER)) OTHER is set to the value of the idx on the other machine. If it is greater than our index, then we need to do some downloading. If it is smaller, then we need to do some uploading Note that we cannot upload if we are not the owner of the record store - hosts can only write to their own store.
Trait Implementations§
Source§impl Debug for RecordStatus
impl Debug for RecordStatus
Source§impl Default for RecordStatus
impl Default for RecordStatus
Source§impl<'de> Deserialize<'de> for RecordStatus
impl<'de> Deserialize<'de> for RecordStatus
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Extend<(HostId, String, u64)> for RecordStatus
impl Extend<(HostId, String, u64)> for RecordStatus
Source§fn extend<T: IntoIterator<Item = (HostId, String, RecordIdx)>>(
&mut self,
iter: T,
)
fn extend<T: IntoIterator<Item = (HostId, String, RecordIdx)>>( &mut self, iter: T, )
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations§
impl Freeze for RecordStatus
impl RefUnwindSafe for RecordStatus
impl Send for RecordStatus
impl Sync for RecordStatus
impl Unpin for RecordStatus
impl UnwindSafe for RecordStatus
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
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>
Converts
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>
Converts
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