aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime/Context.ml
blob: 21897357387b6fbe39c67f4a369d1062f0b946a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Error = struct
  open Concepts.Condition

  let not_a_directory segment =
    condition "not-a-directory" "A path segment named an object with no Directory protocol"
      ("segment" |=| Concepts.Value.String segment)
end

let resolve { Protocols.Context.root; _ } name = Kernel.Path.lookup root name

let over ~snapshot ~root ?(cancelled = fun () -> false) () =
  { Protocols.Context.snapshot
  ; root
  ; status = (fun () -> if cancelled () then `Cancelled else `Live) }