aboutsummaryrefslogblamecommitdiffstats
path: root/lib/protocols/Session.ml
blob: 55580039b75170495bff67390e2c9a8421a1d762 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                                     

                                                        
type state = {branch: string; snapshot: Concepts.Hash.hash}

class type implementation = object
  method state : state
  method pin : state -> unit
end

type Handle.protocol += Session of implementation
type t = implementation

let make impl = Session (impl :> implementation)
let from handle = Handle.into handle (function Session impl -> Some impl | _ -> None)
let state i = Handle.invoke i (fun o -> o#state)
let pin i state = Handle.invoke i (fun o -> o#pin state)