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.

irmin: dune fmt reflow

+22 -24
+12 -12
bin/cmd_clone.ml
··· 1 1 (** [irmin clone] - create a new store seeded from a CAR file. 2 2 3 - Given a CAR snapshot (typically produced by [irmin export] or a 4 - PDS's [com.atproto.sync.getRepo] endpoint), initialise a fresh 5 - local store at [DIR] and import every block from the archive. 6 - The store's head is bound to the first root CID in the CAR. 3 + Given a CAR snapshot (typically produced by [irmin export] or a PDS's 4 + [com.atproto.sync.getRepo] endpoint), initialise a fresh local store at 5 + [DIR] and import every block from the archive. The store's head is bound to 6 + the first root CID in the CAR. 7 7 8 8 This is the one-shot counterpart to [init] + [import] + [set_head]. 9 9 10 - URL support (fetching the CAR over HTTP from a live PDS endpoint) 11 - is not implemented yet; for now [SOURCE] must be a path to a local 12 - CAR file. *) 10 + URL support (fetching the CAR over HTTP from a live PDS endpoint) is not 11 + implemented yet; for now [SOURCE] must be a path to a local CAR file. *) 13 12 14 13 let err_not_car path = 15 14 Common.error "clone: SOURCE must be a .car file; got %a" Common.styled_cyan ··· 56 55 Pds.set_head pds head_cid; 57 56 Pds.close pds; 58 57 Common.success "Cloned %d blocks into %a (HEAD %s)" !count 59 - Common.styled_cyan dir (Atp.Cid.to_string head_cid); 58 + Common.styled_cyan dir 59 + (Atp.Cid.to_string head_cid); 60 60 0 61 61 62 62 let run ~source dir = ··· 67 67 let fs = Eio.Stdenv.cwd env in 68 68 Eio.Switch.run @@ fun sw -> 69 69 match Eio.Path.kind ~follow:false Eio.Path.(fs / dir) with 70 - | `Not_found | `Directory when not (Sys.file_exists dir) 71 - || Sys.readdir dir = [||] -> 70 + | (`Not_found | `Directory) 71 + when (not (Sys.file_exists dir)) || Sys.readdir dir = [||] -> 72 72 do_clone ~sw ~fs ~source ~dir 73 73 | _ -> err_dir_exists dir 74 74 ··· 92 92 `S Manpage.s_description; 93 93 `P 94 94 "Initialise a fresh store at DIR and import every block from the CAR \ 95 - archive at SOURCE. The store's HEAD is bound to the first root CID \ 96 - in the archive."; 95 + archive at SOURCE. The store's HEAD is bound to the first root CID in \ 96 + the archive."; 97 97 `P 98 98 "DIR must not exist, or must be empty. This mirrors the safety \ 99 99 behaviour of [git clone].";
+7 -9
bin/cmd_export.ml
··· 1 1 (** [irmin export] - snapshot a store as a CAR file. 2 2 3 3 Writes every block reachable from the store's head to a CAR 4 - (Content-Addressable aRchive) file. The resulting file is a 5 - portable, hash-integral snapshot — it can be emailed, archived, 6 - or later [import]ed into any store that accepts CAR input. 4 + (Content-Addressable aRchive) file. The resulting file is a portable, 5 + hash-integral snapshot — it can be emailed, archived, or later [import]ed 6 + into any store that accepts CAR input. 7 7 8 - Today only the PDS/ATProto backend is implemented. Git-backed 9 - stores fail with a clear "backend not supported" message; Git 10 - export should use [git bundle] on the underlying [.git] 11 - directory. *) 8 + Today only the PDS/ATProto backend is implemented. Git-backed stores fail 9 + with a clear "backend not supported" message; Git export should use 10 + [git bundle] on the underlying [.git] directory. *) 12 11 13 12 let err_unsupported_backend backend = 14 13 Common.error ··· 40 39 Eio.Switch.run @@ fun sw -> 41 40 match config.Config.backend with 42 41 | Config.Pds -> export_pds ~sw ~fs ~config file 43 - | Config.Git | Config.Memory | Config.Disk as b -> 44 - err_unsupported_backend b 42 + | (Config.Git | Config.Memory | Config.Disk) as b -> err_unsupported_backend b 45 43 46 44 open Cmdliner 47 45
+3 -3
bin/cmd_import.ml
··· 1 1 (** [irmin import] - import a CAR file into the store. 2 2 3 - Today only CAR (Content-Addressable aRchive) files are supported: 4 - every block in the CAR is written to the store's [.irmin/blocks] 5 - filesystem blockstore. Other formats fail fast with a clear error. *) 3 + Today only CAR (Content-Addressable aRchive) files are supported: every 4 + block in the CAR is written to the store's [.irmin/blocks] filesystem 5 + blockstore. Other formats fail fast with a clear error. *) 6 6 7 7 let err_unsupported_format file = 8 8 Common.error "import: only .car files are supported; got %a"