Version
In centralized environments, we can use linear version numbers to represent a version, such as incrementing a number each time or using timestamps. However, CRDTs can be used in decentralized environments, and their version representation is different.
In Loro, you can express a document's version through a Version Vector (opens in a new tab) or Frontiers.
doc.version(); // State Version vector
doc.oplogVersion(); // OpLog Version vector
doc.frontiers(); // State Frontiers
doc.oplogFrontiers(); // OpLog Frontiers
In most cases, you might only need the Version Vector, which can be used for data synchronization and version comparison.
To understand the difference and the definition of Frontiers
, see Loro's Versioning Deep Dive: DAG, Frontiers, and Version Vectors