-
Notifications
You must be signed in to change notification settings - Fork 2
/
list_keys.ml
40 lines (35 loc) · 968 Bytes
/
list_keys.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
open Core.Std
open Async.Std
let option_to_string = function
| Some v -> v
| None -> "<none>"
let fail s =
printf "%s\n" s;
shutdown 1
let exec () =
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
let b = Sys.argv.(3) in
Riakc.Conn.with_conn
~host
~port
(fun c -> Riakc.Conn.list_keys c b)
let eval () =
exec () >>| function
| Ok keys -> begin
List.iter
~f:(printf "%s\n")
keys;
shutdown 0
end
| Error `Bad_conn -> fail "Bad_conn"
| Error `Bad_payload -> fail "Bad_payload"
| Error `Incomplete_payload -> fail "Incomplete_payload"
| Error `Notfound -> fail "Notfound"
| Error `Incomplete -> fail "Incomplete"
| Error `Overflow -> fail "Overflow"
| Error `Unknown_type -> fail "Unknown_type"
| Error `Wrong_type -> fail "Wrong_type"
let () =
ignore (eval ());
never_returns (Scheduler.go ())