From 291a998ca375077b3c23c1e3c43a7fc206c8de4b Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 15 Jan 2017 23:07:39 +0700 Subject: Add functionality for socket communication. The Message module contains read and write functions that take care of the wire protocol, which sends a 4 byte length header before every message. They take a bytes buffer and don't care about its contents. The Vyconf_client module has high level functions for interfacing with vyconfd. Functions for creating a socket and creating a server loop are in Startup. The rest is, for now at least, right in vyconfd. Notes: Message.read/write probably should be wrapped in Lwt_io.atomic We need to find out if it's safe to reuse Pbrt.Encoder.t or we really should create it every time. --- src/vyconf_client.mli | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/vyconf_client.mli (limited to 'src/vyconf_client.mli') diff --git a/src/vyconf_client.mli b/src/vyconf_client.mli new file mode 100644 index 0000000..87fffdd --- /dev/null +++ b/src/vyconf_client.mli @@ -0,0 +1,26 @@ +type t + +type status = + | Success + | Fail + | Invalid_path + | Invalid_value + | Commit_in_progress + | Configuration_locked + | Internal_error + | Permission_denied + | Path_already_exists + +type response = { + status : status; + output : string option; + error : string option; + warning : string option; +} + + +val create : string -> t Lwt.t + +val shutdown : t -> t Lwt.t + +val get_status : t -> response Lwt.t -- cgit v1.2.3