Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move all examples to use Riakc.Conn.with_conn

  • Loading branch information...
commit c51c5a462ab32d73df55cda2c10a0fbf90f6523f 1 parent 25b1398
orbitz authored
9 examples/bucket_props.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
9 examples/client_id.ml
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
9 examples/get.ml
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
9 examples/list_buckets.ml
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
9 examples/list_keys.ml
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
8 examples/ping.ml
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
9 examples/server_info.ml
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
Please sign in to comment.
Something went wrong with that request. Please try again.