Struct yrs::StateVector [−][src]
pub struct StateVector(_);
Expand description
State vector is a compact representation of all known blocks inserted and integrated into a given document. This descriptor can be serialized and used to determine a difference between seen and unseen inserts of two replicas of the same document, potentially existing in different processes.
Another popular name for the concept represented by state vector is Version Vector.
Implementations
Returns a number of unique clients observed by a document, current state vector corresponds to.
Checks if current state vector includes given block identifier. Blocks, which identifiers can be found in a state vectors don’t need to be encoded as part of an update, because they were already observed by their remote peer, current state vector refers to.
Get the latest clock sequence number value for a given client_id
as observed from
the perspective of a current state vector.
Updates a state vector observed clock sequence number for a given client
by incrementing
it by a given delta
.
Updates a state vector observed clock sequence number for a given client
by setting it to
a minimum value between an already present one and the provided clock
. In case if state
vector didn’t contain any value for that client
, a clock
value will be used.
Updates a state vector observed clock sequence number for a given client
by setting it to
a maximum value between an already present one and the provided clock
. In case if state
vector didn’t contain any value for that client
, a clock
value will be used.
Returns an iterator which enables to traverse over all clients and their known clock values described by a current state vector.
Merges another state vector into a current one. Since vector’s clock values can only be incremented, whenever a conflict between two states happen (both state vectors have different clock values for the same client entry), a highest of these to is considered to be the most up-to-date.
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for StateVector
impl Send for StateVector
impl Sync for StateVector
impl Unpin for StateVector
impl UnwindSafe for StateVector
Blanket Implementations
Mutably borrows from an owned value. Read more