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

Checks if current state vector contains any data.

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 a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Helper function for decoding 1st version of lib0 encoding.

Returns the “default value” for a type. Read more

Helper function for encoding 1st version of lib0 encoding.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.