Crdt.Model.NodeIndex
crdt · API reference
Node index - maps timestamps to nodes. The model is already a mutable aggregate, so keep node indexing mutable too: json-joy uses a mutable index, and this avoids allocating a persistent map path for every inserted node.
type key = Clock.timestamptype !'a tval create : int -> 'a tval clear : 'a t -> unitval reset : 'a t -> unitval copy : 'a t -> 'a tval add : 'a t -> key -> 'a -> unitval remove : 'a t -> key -> unitval find : 'a t -> key -> 'aval find_opt : 'a t -> key -> 'a optionval find_all : 'a t -> key -> 'a listval replace : 'a t -> key -> 'a -> unitval mem : 'a t -> key -> boolval iter : (key -> 'a -> unit) -> 'a t -> unitval filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unitval fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'accval length : 'a t -> intval stats : 'a t -> Stdlib.Hashtbl.statisticsval to_seq : 'a t -> (key * 'a) Seq.tval to_seq_keys : 'a t -> key Seq.tval to_seq_values : 'a t -> 'a Seq.tval add_seq : 'a t -> (key * 'a) Seq.t -> unitval replace_seq : 'a t -> (key * 'a) Seq.t -> unitval of_seq : (key * 'a) Seq.t -> 'a t