Library
Module
Module type
Parameter
Class
Class type
Create a journal from a block device. Descriptions of idempotent operations may be pushed to the journal, and we guarantee to perform them at-least-once in the order they were pushed provided the block device is available. If the program crashes, the journal replay will be started when the program restarts.
module Block : S.BLOCK
module Time : S.TIME
module Operation : S.CSTRUCTABLE
type 'a result = ('a, error) Result.result
val pp_error : Stdlib.Format.formatter -> error -> unit
val start :
?name:string ->
?client:string ->
?flush_interval:int64 ->
?retry_interval:int64 ->
Block.t ->
(Operation.t list -> unit result Lwt.t) ->
t result Lwt.t
Start a journal replay thread on a given disk, with the given processing function which will be applied at-least-once to every item in the journal. If a flush_interval
is provided then every push will start a timer and the items will not be processed until the timer expires (or the journal becomes full) to encourage batching. The retry_interval
gives the delay between re'perform'ing journalled items that fail. Default is 5 seconds.
val shutdown : t -> unit Lwt.t
Shut down a journal replay thread
val push : t -> Operation.t -> waiter result Lwt.t
Append an operation to the journal. When this returns, the operation will be performed at-least-once before any later items are performed. If a client needs to wait for the operation to be completed then call the returned thunk and wait for the resulting thread.