Files
oplevel/store.ml
2024-05-12 16:35:35 -05:00

30 lines
912 B
OCaml

open Lwt.Infix
module F = Fmt
module S = Irmin_git_unix.FS.KV (Irmin.Contents.String)
module Sync = Irmin.Sync.Make (S)
type t = S.tree
type tree = t
type step = S.step
type path = step list
let init () = S.Repo.v (Irmin_mem.config ()) >>= S.main >>= S.tree
let info = Irmin_git_unix.info
let test_populate () : t Lwt.t =
let add p s t = S.Tree.add t p s in
add [ "hello" ] "world" (S.Tree.empty ())
>>= add [ "hello"; "daddy" ] "ily"
>>= add [ "beep"; "beep" ] "motherfucker"
let init_default upstream_url : Sync.db Lwt.t =
S.Repo.v (Irmin_git.Conf.init "../rootstore") >>= fun repo ->
S.of_branch repo "lablgtk" >>= fun t ->
S.remote upstream_url >>= fun upstream ->
(* (try Sync.pull_exn t upstream `Set >>= fun _ -> Lwt.return_unit
with Invalid_argument a ->
F.epr "Sync.pull_exn raised Invalid_argument(%s)" a;
Lwt.return_unit)
>>= fun () -> *)
Lwt.return t