Crate yrs

source ·
Expand description

Yrs “wires” is a high performance CRDT implementation based on the idea of Shared Types. It is a compatible port of the Yjs CRDT.

Shared Types work just like normal data types, but they automatically sync with other peers. In Rust, they can automatically sync with their counterparts in other threads.

A Shared Document is the access point to create shared types, and to listen to update events.

Implement a Provider

A provider connects to a shared document and automatically syncs updates through a medium. A provider could sync document updates to other peers through a network protocol, or sync document updates to a database so that they are available without a network connection. You can combine providers with each other to make your application more resilient.

In Yjs, we already have a rich collection of providers that allow you to build resilient applications that sync through multiple communication mediums all at once. We don’t have this ecosystem yet in Yrs, but you can build them easily on your own.

Re-exports

pub use crate::block::ID;
pub use crate::observer::Observer;
pub use crate::observer::Subscription;
pub use crate::observer::SubscriptionId;
pub use crate::types::array::Array;
pub use crate::types::array::ArrayPrelim;
pub use crate::types::array::ArrayRef;
pub use crate::types::map::Map;
pub use crate::types::map::MapPrelim;
pub use crate::types::map::MapRef;
pub use crate::types::text::Text;
pub use crate::types::text::TextPrelim;
pub use crate::types::text::TextRef;
pub use crate::types::xml::Xml;
pub use crate::types::xml::XmlElementPrelim;
pub use crate::types::xml::XmlElementRef;
pub use crate::types::xml::XmlFragment;
pub use crate::types::xml::XmlFragmentPrelim;
pub use crate::types::xml::XmlFragmentRef;
pub use crate::types::xml::XmlNode;
pub use crate::types::xml::XmlTextPrelim;
pub use crate::types::xml::XmlTextRef;
pub use crate::types::GetString;
pub use crate::types::Observable;

Modules

Structs

Holds transaction update information from a commit after state vectors have been compressed.
DeleteSet contains information about all blocks (described by clock ranges) that have been subjected to delete process.
A Yrs document type. Documents are most important units of collaborative resources management. All shared collections live within a scope of their corresponding documents. All updates are generated on per document basis (rather than individual shared type). All operations on shared collections happen via Transaction, which lifetime is also bound to a document.
Configuration options of Doc instance.
Snapshot describes a state of a document store at a given point in (logical) time.
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.
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.
Event used to communicate load requests from the underlying subdocuments.
Update type which contains an information about all decoded blocks which are incoming from a remote peer. Since these blocks are not yet integrated into current document’s block store, they still may require repairing before doing so as they don’t contain full data about their relations.
An update event passed to a callback registered in the event handler. Contains data about the state of an update.

Enums

Determines how string length and offsets of [Text]/[XmlText] are being determined.

Traits

Functions

Type Definitions