Permalink
Browse files

Move all examples to use Riakc.Conn.with_conn

  • Loading branch information...
1 parent 25b1398 commit c51c5a462ab32d73df55cda2c10a0fbf90f6523f orbitz committed Mar 13, 2013
Showing with 28 additions and 34 deletions.
  1. +4 −5 examples/bucket_props.ml
  2. +4 −5 examples/client_id.ml
  3. +4 −5 examples/get.ml
  4. +4 −5 examples/list_buckets.ml
  5. +4 −5 examples/list_keys.ml
  6. +4 −4 examples/ping.ml
  7. +4 −5 examples/server_info.ml
View
@@ -15,14 +15,13 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
let b = Sys.argv.(3) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.bucket_props c b >>= fun props ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok props)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ (fun c -> Riakc.Conn.bucket_props c b)
let eval () =
exec () >>| function
View
@@ -11,13 +11,12 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.client_id c >>= fun client_id ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok client_id)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ Riakc.Conn.client_id
let eval () =
exec () >>| function
View
@@ -35,15 +35,14 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
let b = Sys.argv.(3) in
let k = Sys.argv.(4) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.get c b k >>= fun robj ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok robj)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ (fun c -> Riakc.Conn.get c b k)
let eval () =
exec () >>| function
View
@@ -10,13 +10,12 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.list_buckets c >>= fun buckets ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok buckets)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ Riakc.Conn.list_buckets
let eval () =
exec () >>| function
View
@@ -10,14 +10,13 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
let b = Sys.argv.(3) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.list_keys c b >>= fun keys ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok keys)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ (fun c -> Riakc.Conn.list_keys c b)
let eval () =
exec () >>| function
View
@@ -6,12 +6,12 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.ping c >>= fun () ->
- Riakc.Conn.close c
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ Riakc.Conn.ping
let eval () =
exec () >>| function
View
@@ -10,13 +10,12 @@ let fail s =
shutdown 1
let exec () =
- let open Deferred.Result.Monad_infix in
let host = Sys.argv.(1) in
let port = Int.of_string Sys.argv.(2) in
- Riakc.Conn.connect host port >>= fun c ->
- Riakc.Conn.server_info c >>= fun server_info ->
- Riakc.Conn.close c >>= fun () ->
- return (Ok server_info)
+ Riakc.Conn.with_conn
+ ~host
+ ~port
+ Riakc.Conn.server_info
let eval () =
exec () >>| function

0 comments on commit c51c5a4

Please sign in to comment.