Crdt.Model_codec_verbose
crdt · API reference
Verbose document codec (human-readable JSON)
Verbose structural encoding for CRDT document snapshots.
This module implements the verbose format compatible with json-joy's model.verbose.json format.
The verbose format uses a hierarchical tree structure with explicit type tags for each node, making it human-readable for debugging.
Format overview:
-
time: array of
sid, timepairs (clock vector) -
root: nested node structure starting with the root val node Node formats:
-
con:
{type: "con", id: [sid, time], value?: any} -
val:
{type: "val", id: [sid, time], value?: node} -
obj:
{type: "obj", id: [sid, time], map: {key: node, ...}} -
vec:
{type: "vec", id: [sid, time], slots: node[]} -
arr:
{type: "arr", id: [sid, time], elements: node[]} -
str:
{type: "str", id: [sid, time], chunks: chunk[]} -
bin:
{type: "bin", id: [sid, time], chunks: chunk[]}Chunk format: -
{id: [sid, time], value?: string/bytes, span?: int}
module J = Simdjsont.Jsonval encode_timestamp : Clock.timestamp -> J.tval encode_clock_vector : Clock.clock_vector -> J.tval encode_value : Value.t -> J.tval encode_str_chunks : string Rga.chunk list -> J.tval encode_bin_chunks : bytes Rga.chunk list -> J.tval encode_arr_chunks : Model.t -> Clock.timestamp Rga.chunk list -> J.tval encode_node : Model.t -> Node.t -> J.tval encode : Model.t -> J.tval encode_string : ?minify:bool -> Model.t -> stringval encode_bigstring :
?minify:bool ->
Model.t ->
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t * intval get_member : string -> (string * J.t) list -> J.t optionval decode_timestamp : J.t -> Clock.timestamp optionval decode_clock_vector : J.t -> Clock.clock_vector optionval decode_value : J.t -> Value.tval decode_str_chunks : J.t -> string Rga.tval decode_bin_chunks : J.t -> bytes Rga.tval decode_node : Model.t -> J.t -> Clock.timestamp optionval decode : J.t -> Model.t optionval decode_string : string -> Model.t optionval decode_bigstring :
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
len:int ->
Model.t option