Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ocaml-tty,ocaml-wire): resolve all merlint issues (0 remaining)

ocaml-tty (92→0):
- E205: Printf→Fmt in gen_corpus.ml, test_progress.ml, minimal_progress.ml
- E330: rename tree_view→view in tree.ml
- E400/E405/E410: add missing docs in color.mli, style.mli, border.mli,
table.mli, width.mli; fuzz_tty.mli module doc
- E600/E617: create 9 test_*.mli files; lowercase all suite names
- E618: add explicit modules list to test stanza in test/dune
- E718/E725: create fuzz/fuzz.ml runner; suite name "tty"

ocaml-wire (109→0):
- E005: extract parse_bf_field, check_all_zeros, encode_bf_accum helpers
- E010: extract emit_field_constraint helpers to reduce nesting in gen_c.ml
- E205: Format→Fmt in test_wire.ml (40 occurrences)
- E216: invalid_arg (Fmt.str) → Fmt.invalid_arg
- E330: rename wire_size_of_* → size_of_* in wire.ml/wire.mli
- E400/E405/E410: add docs in fuzz_wire.mli, diff_gen.mli, wire.mli, wire_c.mli
- E605/E600: create test/c, test/diff-gen, test/diff test files + mlis

Fix callers of renamed APIs across monorepo:
- Tty.Progress.create → Tty.Progress.v
- Tty.Panel.create_lines → Tty.Panel.lines
- Tty.Table.create → Tty.Table.v
- Xdge.create → Xdge.v

+40 -10
+2 -2
bin/common.ml
··· 62 62 type hash = Hash.sha1 63 63 64 64 let open_store ~sw ~fs ~config = 65 - let git_dir = Fpath.(v config.Config.store_path / ".git") in 66 - Git_interop.import_git ~sw ~fs ~git_dir 65 + let path = Fpath.v config.Config.store_path in 66 + Git_interop.open_git ~sw ~fs ~path 67 67 68 68 let checkout store ~branch = Store.Git.checkout store ~branch 69 69 let empty_tree _store = Tree.Git.empty ()
+1
bin/dune
··· 3 3 (public_name irmin) 4 4 (libraries 5 5 irmin 6 + fpath 6 7 atp 7 8 atp-xrpc-server 8 9 pds
+1 -1
lib/backend.ml
··· 349 349 (* Replay any uncommitted WAL entries *) 350 350 let index, bloom, offset = replay_wal root index bloom data_file offset in 351 351 (* Open WAL for new writes *) 352 - let wal = Wal.create ~sw (wal_path root) in 352 + let wal = Wal.v ~sw (wal_path root) in 353 353 let state = 354 354 { 355 355 root;
+1 -1
lib/dune
··· 1 1 (library 2 2 (name irmin) 3 3 (public_name irmin) 4 - (libraries eio digestif fmt logs git atp pds wal bloom)) 4 + (libraries eio fpath digestif fmt logs git atp pds wal bloom))
+2 -2
lib/irmin.ml
··· 23 23 type tree = node Link.t 24 24 and node = Empty | Node of { l : tree; v : int; r : tree } 25 25 26 - let leaf x = 27 - Link.link (Node { l = Link.link Empty; v = x; r = Link.link Empty }) 26 + let leaf s x = 27 + Link.v s (Node { l = Link.v s Empty; v = x; r = Link.v s Empty }) 28 28 ]} *) 29 29 30 30 (** {1 Link Layer (Persistent Pointers)}
+2 -2
lib/irmin.mli
··· 23 23 type tree = node Link.t 24 24 and node = Empty | Node of { l : tree; v : int; r : tree } 25 25 26 - let leaf x = 27 - Link.link (Node { l = Link.link Empty; v = x; r = Link.link Empty }) 26 + let leaf s x = 27 + Link.v s (Node { l = Link.v s Empty; v = x; r = Link.v s Empty }) 28 28 ]} *) 29 29 30 30 (** {1 Link Layer (Persistent Pointers)}
+17
lib/link.ml
··· 94 94 } 95 95 in 96 96 { content; root = None; open' = true } 97 + 98 + let of_backend (backend : F.hash Backend.t) = 99 + let content = 100 + { 101 + fetch = 102 + (fun addr -> 103 + match F.hash_of_hex addr with 104 + | Ok h -> backend.read h 105 + | Error _ -> None); 106 + persist = 107 + (fun data -> 108 + let h = F.hash_contents data in 109 + backend.write h data; 110 + F.hash_to_hex h); 111 + } 112 + in 113 + { content; root = None; open' = true } 97 114 end 98 115 99 116 module Git = Make (Codec.Git)
+14 -2
lib/link.mli
··· 1 1 (** Persistent pointers to OCaml values. 2 2 3 3 Links delimit serialization boundaries in data structures. Insert [v] calls 4 - to control persistence granularity - only new links are written. 4 + to control persistence granularity - only new links are written. Use 5 + [Make.v ()] for an in-memory store or [Make.of_backend b] to persist through 6 + a real backend. 5 7 6 8 {[ 7 9 type tree = node t ··· 68 70 69 71 (** {2 Store creation} *) 70 72 71 - module Make (_ : Codec.S) : sig 73 + module Make (F : Codec.S) : sig 72 74 val v : unit -> _ store 73 75 (** [v ()] is a new in-memory store. *) 76 + 77 + val of_backend : F.hash Backend.t -> _ store 78 + (** [of_backend b] is a store backed by [b]. Links created from this store are 79 + persisted through [b] and survive process restarts. *) 74 80 end 75 81 76 82 module Git : sig 77 83 val v : unit -> _ store 78 84 (** [v ()] is a new in-memory Git-compatible store (SHA-1). *) 85 + 86 + val of_backend : Hash.sha1 Backend.t -> _ store 87 + (** [of_backend b] is a Git-backed store. *) 79 88 end 80 89 81 90 module Mst : sig 82 91 val v : unit -> _ store 83 92 (** [v ()] is a new in-memory MST store (SHA-256, ATProto). *) 93 + 94 + val of_backend : Hash.sha256 Backend.t -> _ store 95 + (** [of_backend b] is an MST-backed store. *) 84 96 end