package shared-block-ring
Library
Module
Module type
Parameter
Class
Class type
include S.RING
with type disk := B.t
with type position = Producer.position
with type item = Item.t
type item = Item.t
type 'a result = ('a, error) Result.result
val pp_error : Format.formatter -> error -> unit
val open_error : 'a result -> ('a, [> error ]) Result.result
val error_to_msg : 'a result -> ('a, S.msg) Result.result
attach queue client blockdevice
attaches to a previously-created shared ring on top of blockdevice
.
detach t
frees all resources associated with t
. Attempts to use t
after a detach will result in an `Error _
state t ()
queries the current state of the ring. If the result is `Suspended then the producer has acknowledged and will nolonger produce items. Clients which support suspend/resume should arrange to call this function periodically.
debug_info t
returns a list of key=value pairs which may be useful for debugging. Nothing should be assumed about the keys or the values; they should only be printed or logged.
type position = Producer.position
The position within a stream
val sexp_of_position : position -> Sexplib0.Sexp.t
include S.COMPARABLE with type t := position
suspend t
signals that the producer should stop pushing items. Note this function returns before the producer has acknowledged. The result `Retry means that a previous call to resume
has not been acknowledged; the client should retry.
resume t
signals that a producer may again start pushing items. This call does not wait for an acknowledgement from the producer. Note it is not an error to resume an already-resumed queue. The result `Retry means that a previous call to suspend
has not been acknowledged; the client should retry.
peek t ?position ()
returns a pair (position, item)
where item
is the next item on the ring after from
. Repeated calls to pop
will return the same item
. To indicate that the item has been processed, call advance position
. `Retry
means there is no item available at the moment and the client should try again later.
val fold :
f:(item -> 'a -> 'a) ->
t:t ->
?from:position ->
init:'a ->
unit ->
(position * 'a) result Lwt.t
peek_all f t ?position init ()
folds f
across all the values that can be immediately peek
ed from the ring. If any of the fold
operations fail then the whole operation fails. The successful result includes the final position
which can be used to consume all the items at once.