diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-09-30 20:15:03 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-09-30 20:15:03 +0600 |
commit | 7c7fdeb7e906d4f69b39cdf1635d706e04069e3f (patch) | |
tree | 0fe60c8f43f83c1e311e21a420797c683d8992fe | |
parent | 0acd427af061b35e613eaa0d80cfc80d1a93faff (diff) | |
download | vyconf-7c7fdeb7e906d4f69b39cdf1635d706e04069e3f.tar.gz vyconf-7c7fdeb7e906d4f69b39cdf1635d706e04069e3f.zip |
Add get_values method to the message decoder.
-rw-r--r-- | src/message.ml | 5 | ||||
-rw-r--r-- | src/message.mli | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/message.ml b/src/message.ml index 673d5e8..f56a532 100644 --- a/src/message.ml +++ b/src/message.ml @@ -5,6 +5,7 @@ type operation = | Set of string list | Delete of string list | Show of (string list option) * ((string * string) list option) + | GetValues of string list type message = { session_id: string; @@ -34,6 +35,10 @@ let decode_operation op = | "set" -> Set (value_of_path op.path) | "delete" -> Delete (value_of_path op.path) | "show" -> Show (op.path, op.options) + | "get_values" -> + (match op.path with + | Some path -> GetValues path + | None -> raise (Invalid_operation "Operation requires a path")) | _ -> raise (Invalid_operation "Invalid operation name") let decode_message msg = diff --git a/src/message.mli b/src/message.mli index 2688b8c..b610200 100644 --- a/src/message.mli +++ b/src/message.mli @@ -5,6 +5,7 @@ type operation = | Set of string list | Delete of string list | Show of (string list option) * ((string * string) list option) + | GetValues of string list type message = { session_id: string; |