File tree Expand file tree Collapse file tree 4 files changed +21
-10
lines changed
Expand file tree Collapse file tree 4 files changed +21
-10
lines changed Original file line number Diff line number Diff line change 11# -*- conf -*-
22
33description = "Kinetic client"
4- version = "0.0.3 "
4+ version = "0.0.4 "
55exists_if = "kinetic.cmx,kinetic.cmi,kinetic.mli"
66requires = "threads lwt lwt.unix cryptokit"
77archive(byte) = "kinetic.client.cma"
Original file line number Diff line number Diff line change @@ -4,11 +4,6 @@ This is an OCaml client for [Seagate's Kinetic drives](https://developers.seagat
44Currently, it uses protocol version 3.0.6.
55This is corresponds with version 0.8.0.3 of the Java Simulator.
66
7- Todo:
8- - [X] support 3.X protocol
9- - [ ] use 4.0.2 Bytes iso strings for buffers (depends on piqi)
10- - [X] opam installable
11- - [ ] publish 0.0.3 on opam repo
127
138Installation
149============
Original file line number Diff line number Diff line change @@ -333,7 +333,8 @@ struct
333333
334334 let remove t h = Hashtbl. remove t h
335335
336- let make session (ic ,oc ) batch_id =
336+ let make session conn batch_id =
337+ let ic,oc = conn in
337338 let handlers = Hashtbl. create 5 in
338339 let mvar = Lwt_mvar. create_empty () in
339340 let rec loop (go :bool ref ) (ic :Lwt_io.input_channel ) =
@@ -379,9 +380,22 @@ struct
379380 end
380381 in
381382 let go = ref true in
382- let t = loop go ic in
383+ let t =
384+ Lwt. catch
385+ (fun () ->loop go ic )
386+ (fun exn ->
387+ Lwt_log. debug_f ~exn ~section " batch loop for %li failed" batch_id
388+ >> = fun () ->
389+ let rci = status_code2i `internal_error in
390+ let rc_bad = Nok (rci, Printexc. to_string exn ) in
391+ Hashtbl. iter (fun k h ->
392+ Lwt. ignore_result (h rc_bad);
393+ ) handlers;
394+ Lwt. return ()
395+ )
396+ in
383397 let () = Lwt. ignore_result t in
384- { mvar ; handlers ; conn = (ic,oc) ; batch_id; go = go; session}
398+ { mvar ; handlers ; conn; batch_id; go = go; session}
385399
386400 let add_handler t typ h =
387401 let typs = message_type2s typ in
Original file line number Diff line number Diff line change @@ -88,7 +88,9 @@ module Kinetic : sig
8888
8989 (* *
9090 Batches are atomic multi-updates.
91- (while you're doing a batch, you're not supposed to use the connection )
91+ Remark:
92+ - while you're doing a batch, you're not supposed to use the connection
93+ - handlers should not raise exceptions as these have no where to go.
9294 *)
9395 val start_batch_operation :
9496 ?handler : handler ->
You can’t perform that action at this time.
0 commit comments