this repo has no description
1type t = {
2 hash : string;
3 dir : Fpath.t;
4}
5
6let of_hash ~os_dir hash =
7 let len = min 12 (String.length hash) in
8 let name = String.sub hash 0 len in
9 { hash; dir = Fpath.(os_dir / name) }
10
11let hash t = t.hash
12let dir t = t.dir
13let fs t = Fpath.(t.dir / "fs")
14let meta_path t = Fpath.(t.dir / "layer.json")
15let log_path t = Fpath.(t.dir / "layer.log")
16
17let pp f t =
18 Fmt.pf f "%s" (String.sub t.hash 0 (min 12 (String.length t.hash)))
19
20let exists t =
21 Bos.OS.File.exists (meta_path t) |> Result.get_ok
22
23let is_ok t =
24 match Meta.load (meta_path t) with
25 | Ok meta -> meta.exit_status = 0
26 | Error _ -> false