Struct yrs::Store

source ·
pub struct Store { /* private fields */ }
Expand description

Store is a core element of a document. It contains all of the information, like block store map of root types, pending updates waiting to be applied once a missing update information arrives and all subscribed callbacks.

Implementations§

Get the latest clock sequence number observed and integrated into a current store client. This is exclusive value meaning it describes a clock value of the beginning of the next block that’s about to be inserted. You cannot use that clock value to find any existing block content.

Encodes all changes from current transaction block store up to a given snapshot. This enables to encode state of a document at some specific point in the past.

Compute a diff to sync with another client.

This is the most efficient method to sync with another client by only syncing the differences.

The sync protocol in Yrs/js is:

  • Send StateVector to the other client.
  • The other client comutes a minimal diff to sync by using the StateVector.

Returns a collection of sub documents linked within the structures of this document store.

Returns a collection of globally unique identifiers of sub documents linked within the structures of this document store.

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Encodes the document state to a binary format.

Document updates are idempotent and commutative. Caveats:

  • It doesn’t matter in which order document updates are applied.
  • As long as all clients receive the same document updates, all clients end up with the same content.
  • Even if an update contains known information, the unknown information is extracted and integrated into the document structure.
Helper function for encoding 1st version of lib0 encoding.
Helper function for encoding 1st version of lib0 encoding.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. 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.