Skip to main content

crdt_for_declared_type

Function crdt_for_declared_type 

Source
pub fn crdt_for_declared_type(type_name: &str) -> Option<RuntimeValue>
Expand description

A fresh, empty CRDT replica for a declared CRDT type name, or None for a type that is not one.

A Shared struct’s CRDT fields default to an empty LIVE CRDT, mirroring the compiled tier’s ORSet/RGA field. Counter fields are per-replica CRDTs too (GCounter/PNCounter), so their merge is idempotent — a bare Int would merge by overwrite and lose concurrent increments.

Split out from default_for_declared_type because the CRDT half has a SECOND question to answer that the scalar half does not: “is this name a CRDT at all?” — which is what lets a declared type decide whether a slot holds a converging value, without that decision being spelled out again at every site that needs it.