aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Addressable.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/protocols/Addressable.ml')
-rw-r--r--lib/protocols/Addressable.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/protocols/Addressable.ml b/lib/protocols/Addressable.ml
new file mode 100644
index 0000000..7e97f08
--- /dev/null
+++ b/lib/protocols/Addressable.ml
@@ -0,0 +1,13 @@
+class type implementation = object
+ method address : Concepts.Hash.hash
+end
+
+type Handle.protocol += Addressable of implementation
+
+type t = implementation
+
+let make impl = Addressable (impl :> implementation)
+
+let from handle = Handle.into handle (function Addressable impl -> Some impl | _ -> None)
+
+let address i = Handle.invoke i (fun o -> o#address)