aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Directory.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/protocols/Directory.ml')
-rw-r--r--lib/protocols/Directory.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/protocols/Directory.ml b/lib/protocols/Directory.ml
new file mode 100644
index 0000000..5a2637f
--- /dev/null
+++ b/lib/protocols/Directory.ml
@@ -0,0 +1,16 @@
+class type implementation = object
+ method list : string list
+ method find : string -> Handle.t option
+end
+
+type Handle.protocol += Directory of implementation
+
+type t = implementation
+
+let make impl = Directory impl
+
+let from handle = Handle.into handle (function Directory impl -> Some impl | _ -> None)
+
+let list i = Handle.invoke i (fun o -> o#list)
+
+let find i name = Handle.invoke i (fun o -> o#find name)