diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-10-10 02:17:58 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-10-10 02:17:58 +0000 |
| commit | 90e41279094c26e6fcc93966708374b8ceba80e4 (patch) | |
| tree | 1b3dbf67da6655bc3458f7a4f1f2595c0e197d16 /lib/kernel | |
| parent | 6201bbc6e7171f037467bbfc2d0a6da084fb516c (diff) | |
| download | RNT-lifecycle-ergonomics.tar.gz RNT-lifecycle-ergonomics.zip | |
Stylelifecycle-ergonomics
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/Namespace.ml | 11 | ||||
| -rw-r--r-- | lib/kernel/Namespace.mli | 1 | ||||
| -rw-r--r-- | lib/kernel/Path.ml | 8 | ||||
| -rw-r--r-- | lib/kernel/Session.ml | 1 |
4 files changed, 8 insertions, 13 deletions
diff --git a/lib/kernel/Namespace.ml b/lib/kernel/Namespace.ml index c7cc627..c7c0767 100644 --- a/lib/kernel/Namespace.ml +++ b/lib/kernel/Namespace.ml @@ -5,7 +5,6 @@ class namespace = method to_string = "namespace" val entries : (string, Protocols.Handle.t) BatMap.t Atomic.t = Atomic.make BatMap.empty method protocols = Protocols.[Directory.make self; Registry.make self] - method destroy = Atomic.get entries |> BatMap.values |> BatEnum.iter Protocols.Handle.release method update key reference value = @@ -13,11 +12,11 @@ class namespace = Utilities.Atomic.mswap entries (fun e -> let existing = BatMap.find_opt key e in if existing = reference then begin - Option.map Protocols.Handle.release existing |> ignore; - match value with - | Some v -> Ok (BatMap.add key (Protocols.Handle.move v) e) - | None -> Ok (BatMap.remove key e) - end + Option.map Protocols.Handle.release existing |> ignore; + match value with + | Some v -> Ok (BatMap.add key (Protocols.Handle.move v) e) + | None -> Ok (BatMap.remove key e) + end else Error () ) with | Ok _ -> Ok true diff --git a/lib/kernel/Namespace.mli b/lib/kernel/Namespace.mli index 9d4f343..394e44a 100644 --- a/lib/kernel/Namespace.mli +++ b/lib/kernel/Namespace.mli @@ -2,7 +2,6 @@ class namespace : object inherit Protocols.Handle.obj inherit Protocols.Directory.implementation inherit Protocols.Registry.implementation - method destroy : unit end diff --git a/lib/kernel/Path.ml b/lib/kernel/Path.ml index a2e270e..2e712cc 100644 --- a/lib/kernel/Path.ml +++ b/lib/kernel/Path.ml @@ -23,8 +23,7 @@ let walking f g handle path = let open Protocols in let open Utilities.Result in let rec walk handle = function - | [] -> - g (Handle.keep handle) + | [] -> g (Handle.keep handle) | x :: xs -> ( let* dir = Handle.require Directory.from handle @@ -36,11 +35,10 @@ let walking f g handle path = | None -> Error (Error.path_not_found path) | Some elem -> f x handle (fun () -> walk elem xs) ) in - Handle.with_autorelease - (fun () -> + Handle.with_autorelease (fun () -> walk handle path |> Result.map_error - Concepts.Condition.(complement ("path" |=| Concepts.Value.String (to_string path)))) + Concepts.Condition.(complement ("path" |=| Concepts.Value.String (to_string path))) ) let lookup handle path = walking (fun _ _ f -> f ()) Result.ok handle path diff --git a/lib/kernel/Session.ml b/lib/kernel/Session.ml index 0f5f353..231f518 100644 --- a/lib/kernel/Session.ml +++ b/lib/kernel/Session.ml @@ -13,7 +13,6 @@ module Make (S : Abstract.Storage.STORAGE) = struct method pin state' = Atomic.set state state' method protocols = Protocols.[Directory.make self; Session.make self] method list = Ok (BatFingerTree.singleton "branch") - method destroy = () method find = |
