Module Multispool.Make
Parameters
Signature
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
type spool= t
val dir : t -> stringval load : ?create_if_missing:unit -> string -> t Async.Deferred.Or_error.tOpen a
Multispool.t. This function will fail by default if the spool directory does not exist, does not look like a spool, or does not contain the set of directories named after the strings returned bySpoolable.Queue.to_dir. Pass~create_if_missing:()to create the necessary directories.Note that, even if
~create_if_missing:()is specified, this function will still fail if the supplied directory is non-empty and not already a spool.
val load_unsafe : string -> tOpen a
Multispool.twith no spool directory validation.
val create : string -> t Async.Deferred.Or_error.tOpen a
Multispool.tand create the spool directory if necessary. This is functionally identical toload ?create_if_missing:().
module Data_file : sig ... endProvide access to a
Spoolable.Data.t.Data_file.tfunctions as a "handle" to the underlying data so the user can choose when to read aSpoolable.Data.t.
module Entry : sig ... endAn
Entryis associated with a particular queue
val list : t -> Spoolable.Queue.t -> Entry.t list Async.Deferred.Or_error.t
module Unique_name : sig ... endval enqueue : t -> Spoolable.Queue.t -> Spoolable.Metadata.t -> Spoolable.Data.t -> [ `Reserve of Spoolable.Name_generator.t | `Use of Spoolable.Name_generator.Unique_name.t ] -> Entry.t Async.Deferred.Or_error.tAdd a
Spoolableto a queue. AnEntry.tis returned, but it may make sense to ignore it.
val with_entry : f:(Spoolable.Metadata.t -> Data_file.t -> ([ `Save of Spoolable.Metadata.t * Spoolable.Queue.t | `Remove ] * 'a) Async.Deferred.t) -> Entry.t -> 'a Async.Deferred.Or_error.tDo something with the contents of an entry within
f. Usewith_entryif you expect to be the only user of anEntry.tand it is an error if the Entry.t is grabbed by another process (or otherwise disappears). Seecheckoutfor a lower-level interface.
val with_entry' : f:(Spoolable.Metadata.t -> Data_file.t -> ([ `Save of Spoolable.Metadata.t * Spoolable.Queue.t | `Remove ] * 'a) Async.Deferred.t) -> Entry.t -> [ `Ok of 'a | `Not_found ] Async.Deferred.Or_error.tLike
with_entry, but usewith_entry'if you expect that another process might race to grab anEntry.tand want straightforward handling. Seecheckout'for a lower-level interface.
module Queue_reader : sig ... endInterface for iteration and waiting on queue activity. Multiple processes will not interfere with one another.
module Expert : sig ... end