diff options
Diffstat (limited to 'lib/protocols/Registry.ml')
| -rw-r--r-- | lib/protocols/Registry.ml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/protocols/Registry.ml b/lib/protocols/Registry.ml new file mode 100644 index 0000000..4e3a44e --- /dev/null +++ b/lib/protocols/Registry.ml @@ -0,0 +1,16 @@ +class type implementation = object + method register : string -> Handle.t -> (unit, Concepts.Condition.condition) result + method unregister : string -> (unit, Concepts.Condition.condition) result +end + +type Handle.protocol += Registry of implementation + +type t = implementation + +let make impl = Registry impl + +let from handle = Handle.into handle (function Registry impl -> Some impl | _ -> None) + +let register i key value = Handle.invoke i (fun o -> o#register key value) + +let unregister i key = Handle.invoke i (fun o -> o#unregister key) |
