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.
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.
pub use crate::block::ID;
pub use crate::types::array::Array;
pub use crate::types::array::PrelimArray;
pub use crate::types::map::Map;
pub use crate::types::map::PrelimMap;
pub use crate::types::text::Text;
pub use crate::types::xml::Xml;
pub use crate::types::xml::XmlElement;
pub use crate::types::xml::XmlText;
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.
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.
Transaction is one of the core types in Yrs. All operations that need to touch a document’s contents (a.k.a. block store), need to be executed in scope of a transaction.
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.