Struct yrs::Transaction
source · #[repr(transparent)]pub struct Transaction(_);Expand description
Transaction is one of the core types in Yrs. All operations that need to touch or modify a document’s contents (a.k.a. block store), need to be executed in scope of a transaction.
Trait Implementations§
source§impl ReadTxn for Transaction
impl ReadTxn for Transaction
fn store(&self) -> &Store
source§fn state_vector(&self) -> StateVector
fn state_vector(&self) -> StateVector
Returns state vector describing current state of the updates.
source§fn snapshot(&self) -> Snapshot
fn snapshot(&self) -> Snapshot
Returns a snapshot which describes a current state of updates and removals made within
the corresponding document. Read more
source§fn encode_state_from_snapshot<E>(
&self,
snapshot: &Snapshot,
encoder: &mut E
) -> Result<(), Error>where
E: Encoder,
fn encode_state_from_snapshot<E>(
&self,
snapshot: &Snapshot,
encoder: &mut E
) -> Result<(), Error>where
E: Encoder,
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. Read moresource§fn encode_diff<E>(&self, state_vector: &StateVector, encoder: &mut E)where
E: Encoder,
fn encode_diff<E>(&self, state_vector: &StateVector, encoder: &mut E)where
E: Encoder,
Encodes the difference between remove peer state given its
state_vector and the state
of a current local peer Read morefn encode_diff_v1(&self, state_vector: &StateVector) -> Vec<u8, Global>
fn encode_state_as_update<E>(&self, sv: &StateVector, encoder: &mut E)where
E: Encoder,
fn encode_state_as_update_v1(&self, sv: &StateVector) -> Vec<u8, Global>
fn encode_state_as_update_v2(&self, sv: &StateVector) -> Vec<u8, Global>
source§fn root_refs(&self) -> RootRefs<'_>
fn root_refs(&self) -> RootRefs<'_>
Returns an iterator over top level (root) shared types available in current Doc.
source§fn subdoc_guids(&self) -> SubdocGuids<'_>
fn subdoc_guids(&self) -> SubdocGuids<'_>
Returns a collection of globally unique identifiers of sub documents linked within
the structures of this document store. Read more
source§fn subdocs(&self) -> SubdocsIter<'_>
fn subdocs(&self) -> SubdocsIter<'_>
Returns a collection of sub documents linked within the structures of this document store.
source§fn get_map(&self, name: &str) -> Option<MapRef>
fn get_map(&self, name: &str) -> Option<MapRef>
Returns a MapRef data structure stored under a given
name. Maps are used to store key-value
pairs associated together. These values can be primitive data (similar but not limited to
a JavaScript Object Notation) as well as other shared types (Yrs maps, arrays, text
structures etc.), enabling to construct a complex recursive tree structures. Read moresource§fn get_xml_fragment(&self, name: &str) -> Option<XmlFragmentRef>
fn get_xml_fragment(&self, name: &str) -> Option<XmlFragmentRef>
Returns a XmlFragmentRef data structure stored under a given
name. XML elements represent
nodes of XML document. They can contain attributes (key-value pairs, both of string type)
as well as other nested XML elements or text values, which are stored in their insertion
order. Read moresource§fn get_xml_element(&self, name: &str) -> Option<XmlElementRef>
fn get_xml_element(&self, name: &str) -> Option<XmlElementRef>
Returns a XmlElementRef data structure stored under a given
name. XML elements represent
nodes of XML document. They can contain attributes (key-value pairs, both of string type)
as well as other nested XML elements or text values, which are stored in their insertion
order. Read moresource§fn get_xml_text(&self, name: &str) -> Option<XmlTextRef>
fn get_xml_text(&self, name: &str) -> Option<XmlTextRef>
Returns a XmlTextRef data structure stored under a given
name. Text structures are used
for collaborative text editing: they expose operations to append and remove chunks of text,
which are free to execute concurrently by multiple peers over remote boundaries. Read more