Platform Manual
Data Types
the conflict free replicated data type (crdt) data structure enables smooth peer‑to‑peer offline replication and online sync in distributed systems when multiple offline ditto stores make concurrent updates to the same crdt object, the crdt merge mechanism remediates the data collision so that, when sync takes place, they converge to a consistent state for more information, see the platform manual > docid\ vh2a6otl4dlnel0a miu8 following are the types of crdts you can use in ditto for an overview of documents, including fields and key value pairs, see docid\ amty0ophec33hdf 1iohz docid\ eexdc d t6lr3vggco7qy docid\ ltcthsbi4y0u7rnswnejg docid\ y7l 8jgjrdwl 3aepgpv2 docid\ slqobcnxtyf keli7l8f8 supported types overview the following table provides a quick overview of the advanced data types you can use in ditto, along with their guiding principles for conflict resolution, or merge semantics , a brief description, and a common usage scenario type merge semantics description use case register last‑write‑wins register, delta state replication stores a single value and allows for concurrent updates updates associated with later temporal timestamps always win map add wins map, delta state replication working in conjunction with the register, stores the mapping of temporal timestamps to the values written in the register to help resolve concurrency conflicts make a list of items in a document and update those items over time counter positive or negative counter, the sum of all site id counters, delta state replication converts a number value for a given key into a counter unlike a primitive number , value increments and decrements merge without conflict manage inventory and handle votes, such as stock details and survey results attachment last write‑wins register, merges only when explicitly fetched stores very large amounts of binary data, such as an image file, and allows for concurrent updates reduce small peer resource usage by storing data outside of memory array last‑write‑wins register, delta state replication an extension of the register type, learning resource interactive tutorial if you prefer learning by doing, see jake lazaroff's blog for a hands on tutorial " https //jakelazaroff com/words/an interactive intro to crdts/ " update behavior by type the following table provides an overview of the crdts and associated behavior for a given operation for more information, see docid 1cexfnswhjeqa r6yyl 8 operation description set register sets the value for a given field in the document set map sets value for a given field in the map remove register removes a value for a given field in the document remove map removes a value for a given key in the map structure replace with counter converts a number value for a given field into a counter increment counter unlike a number , increments the counter by the given positive integer value decrement counter unlike a number , decrements the counter by the given negative integer value