From 43ff14bfe52d4c8b4fcbd593f6e166751a4038e5 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sun, 27 Sep 2026 23:16:06 -0300 Subject: drop session require in favor of handle's --- lib/protocols/Session.ml | 9 --------- lib/protocols/Session.mli | 1 - test/unit/kernel/Session.ml | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/protocols/Session.ml b/lib/protocols/Session.ml index f740c1a..5558003 100644 --- a/lib/protocols/Session.ml +++ b/lib/protocols/Session.ml @@ -1,11 +1,3 @@ -module Error = struct - open Concepts.Condition - - let not_a_session () = - condition "not-a-session" "A handle was expected to carry the session protocol and did not" - empty -end - type state = {branch: string; snapshot: Concepts.Hash.hash} class type implementation = object @@ -18,6 +10,5 @@ type t = implementation let make impl = Session (impl :> implementation) let from handle = Handle.into handle (function Session impl -> Some impl | _ -> None) -let require handle = from handle |> Option.to_result ~none:(Error.not_a_session ()) let state i = Handle.invoke i (fun o -> o#state) let pin i state = Handle.invoke i (fun o -> o#pin state) diff --git a/lib/protocols/Session.mli b/lib/protocols/Session.mli index 141c250..42c508c 100644 --- a/lib/protocols/Session.mli +++ b/lib/protocols/Session.mli @@ -8,6 +8,5 @@ end val make : #implementation -> Handle.protocol val from : Handle.t -> t Handle.interface option -val require : Handle.t -> (t Handle.interface, Concepts.Condition.condition) result val state : t Handle.interface -> state val pin : t Handle.interface -> state -> unit diff --git a/test/unit/kernel/Session.ml b/test/unit/kernel/Session.ml index a20c298..86b2fd8 100644 --- a/test/unit/kernel/Session.ml +++ b/test/unit/kernel/Session.ml @@ -33,7 +33,7 @@ module Make (S : Abstract.Storage.STORAGE) (C : Helpers.Storage.CONFIGURATOR) = let* _ = update root ("branch" @/ this) "master" (Some branch) (Some branch') in let unchanged = finds root library in let* tip' = address branch' in - let* interface = Protocols.Session.require session in + let* interface = Protocols.Handle.require Protocols.Session.from session in Protocols.Session.pin interface {Protocols.Session.branch= "master"; snapshot= tip'}; let after = finds root library in let followed = Protocols.Session.state interface in -- cgit v1.2.3