package git-kv
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A Mirage_kv implementation using git
Install
dune-project
Dependency
Authors
Maintainers
Sources
git-kv-0.2.1.tbz
sha256=dc8669aa66f44f8423ced576911ec6bce1943565a99c1a6c6aa67e19db428a90
sha512=0ed3ccb5f352da278d247c11551c6eedcf29897f090a11684005c44d8e4f6a93bfc2fe78e3236a1c5f9e174d12c03bd8d0ace1a8e91ab03c26ba263df10a8442
doc/src/git-kv.mem/git_shallow.ml.html
Source file git_shallow.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42open Lwt.Infix module SHA1 = Digestif.SHA1 type t = { r: Lwt_mutex.t; mutable b: int; g: Lwt_mutex.t; mutable shallow: SHA1.t list; } (* XXX(dinosaure): simple Raynal's readers/writer lock. *) let safely_get ~f t = Lwt_mutex.lock t.r >>= fun () -> t.b <- succ t.b; (if t.b = 1 then Lwt_mutex.lock t.g else Lwt.return ()) >>= fun () -> Lwt_mutex.unlock t.r; let res = f t.shallow in Lwt_mutex.lock t.r >>= fun () -> t.b <- pred t.b; if t.b = 0 then Lwt_mutex.unlock t.g; Lwt_mutex.unlock t.r; Lwt.return res let identity x = x let exists t ~equal uid = safely_get ~f:(List.exists (equal uid)) t let get t = safely_get ~f:identity t let append t uid = Lwt_mutex.lock t.g >>= fun () -> t.shallow <- uid :: t.shallow; Lwt_mutex.unlock t.g; Lwt.return_unit let remove t ~equal uid = Lwt_mutex.lock t.g >>= fun () -> t.shallow <- List.filter (fun uid' -> not (equal uid uid')) t.shallow; Lwt_mutex.unlock t.g; Lwt.return_unit let make shallow = {r= Lwt_mutex.create (); b= 0; g= Lwt_mutex.create (); shallow}
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>