aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-09-17 02:20:19 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-09-17 02:20:19 +0000
commitccfb6d58dc469a8f8a7e2e09bd520aea71f8cbf3 (patch)
tree32739d84839f72ed24f7a778239db3b3473542a0 /lib/runtime
parent4a172f7bc032d9d0e16fa446f1f5e19cc4feb0fe (diff)
downloadRNT-ccfb6d58dc469a8f8a7e2e09bd520aea71f8cbf3.tar.gz
RNT-ccfb6d58dc469a8f8a7e2e09bd520aea71f8cbf3.zip
Implement `resolve` in terms of the path utilities
Diffstat (limited to 'lib/runtime')
-rw-r--r--lib/runtime/Context.ml18
-rw-r--r--lib/runtime/Context.mli2
2 files changed, 2 insertions, 18 deletions
diff --git a/lib/runtime/Context.ml b/lib/runtime/Context.ml
index 000f5d6..2189735 100644
--- a/lib/runtime/Context.ml
+++ b/lib/runtime/Context.ml
@@ -6,23 +6,7 @@ module Error = struct
("segment" |=| Concepts.Value.String segment)
end
-let resolve { Protocols.Context.root; _ } name =
- let open Utilities.Result in
- let rec walk handle = function
- | [] -> Ok (Protocols.Handle.copy handle)
- | segment :: rest ->
- let* directory =
- Protocols.Directory.from handle
- |> Option.to_result ~none:(Error.not_a_directory segment)
- in
- let* found = Protocols.Directory.find directory segment in
- match found with
- | None -> Ok None
- | Some child ->
- Fun.protect ~finally:(fun () -> Protocols.Handle.release child)
- (fun () -> walk child rest)
- in
- String.split_on_char '/' name |> List.filter (fun segment -> segment <> "") |> walk root
+let resolve { Protocols.Context.root; _ } name = Kernel.Path.lookup root name
let over ~snapshot ~root ?(cancelled = fun () -> false) () =
{ Protocols.Context.snapshot
diff --git a/lib/runtime/Context.mli b/lib/runtime/Context.mli
index 6e7ab2f..214071b 100644
--- a/lib/runtime/Context.mli
+++ b/lib/runtime/Context.mli
@@ -1,6 +1,6 @@
val resolve :
Protocols.Context.t ->
- string ->
+ Kernel.Path.t ->
(Protocols.Handle.t option, Concepts.Condition.condition) result
val over :