shared-block-ring

A single-consumer single-producer queue on a block device
IN THIS PACKAGE
Module type Shared_block . S . RING
type t
type disk
type item
type error = [
| `Retry
| `Suspended
| `Msg of string
]
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, msg ) Result.result
val attach : ?queue:string -> ?client:string -> disk:disk -> unit -> t result Lwt.t

attach queue client blockdevice attaches to a previously-created shared ring on top of blockdevice.

val detach : t -> unit Lwt.t

detach t frees all resources associated with t. Attempts to use t after a detach will result in an `Error _

val state : t -> [ `Running | `Suspended ] result Lwt.t

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.

val debug_info : t -> (string * string) list result Lwt.t

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

The position within a stream

val sexp_of_position : position -> Sexplib0.Sexp.t
include COMPARABLE with type t := position
val compare : position -> position -> [ `LessThan | `Equal | `GreaterThan ]

Compare two items

val advance : t:t -> position:position -> unit -> unit result Lwt.t

advance t position exposes the item associated with position to the Consumer so it can be popped.