Crdt.Patch_codec

crdt · API reference

JSON codec for patches (verbose format)

JSON codec for Patch (verbose format).

Encodes/decodes patches in the json-joy verbose JSON format:

  {"id": [sid, time], "ops": [...operations...

This matches the format in patches.verbose.json conformance traces.

module J = Simdjsont.Json
val encode_patch_json : Patch.t -> J.t
val encode : Patch.t -> string
val encode_bigstring : 
  Patch.t ->
  (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t * int
val encode_pretty : Patch.t -> string
val get_member : string -> (string * J.t) list -> J.t option
val decode_patch_json : J.t -> (Patch.t, string) result
val decode : string -> (Patch.t, string) result
val decode_bigstring : 
  (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
  len:int ->
  (Patch.t, string) result
val decode_ndjson_seq : 
  ?batch_size:int ->
  Simdjsont.Raw.buffer ->
  len:int ->
  (Patch.t, string) result Seq.t
val encode_batch_json : Patch.batch -> J.t
val encode_batch : Patch.batch -> string
val encode_batch_bigstring : 
  Patch.batch ->
  (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t * int
val decode_batch_json : J.t -> (Patch.batch, string) result
val decode_batch : string -> (Patch.batch, string) result
val decode_batch_bigstring : 
  (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t ->
  len:int ->
  (Patch.batch, string) result