Oban.Job
oban · API reference
Describe and inspect durable work.
type idval id_to_int64 : id -> int64type queueval parse_queue :
string ->
(queue,
[> `Empty_queue
| `Invalid_queue_utf8
| `Queue_contains_null
| `Queue_too_long of int ])
resultParse non-empty UTF-8 without U+0000, bounded by Limits.max_name_bytes.
val queue_to_string : queue -> stringtype worker_nameval parse_worker_name :
string ->
(worker_name,
[> `Empty_worker
| `Invalid_worker_utf8
| `Worker_contains_null
| `Worker_too_long of int ])
resultParse non-empty UTF-8 without U+0000, bounded by Limits.max_name_bytes.
val worker_name_to_string : worker_name -> stringtype tagval parse_tag :
string ->
(tag,
[> `Empty_tag
| `Invalid_tag_utf8
| `Tag_contains_null
| `Tag_too_long of int ])
resultParse non-empty UTF-8 without U+0000, bounded by Limits.max_tag_bytes. Tags are case-sensitive.
val tag_to_string : tag -> stringtype metadataval parse_metadata :
Simdjsont.Json.t ->
(metadata, [> `Invalid_metadata | `Metadata_too_large of int ]) resultParse a JSON object bounded by Limits.max_metadata_bytes.
val metadata_to_json : metadata -> Simdjsont.Json.ttype priorityval parse_priority : int -> (priority, [> `Invalid_priority of int ]) resultParse a priority from Limits.min_priority (highest) through Limits.max_priority.
val priority_to_int : priority -> inttype state =
| Available
| Executing
| Completed
| Cancelled
| Discardedval state_to_string : state -> stringval state_of_string : string -> (state, [> `Invalid_state of string ]) resulttype availabletype executingtype error_entry = {
at : Ptime.t;
attempt : int;
kind : string;
message : string;
}type specAn unpersisted job description.
type 'state tA persisted job indexed by its lifecycle state.
type packed =
| Pack : 'state t -> packed (* A persisted job whose state is known at runtime. *)type snapshot = {
id : id;
state : state;
queue : queue;
worker : worker_name;
args : Simdjsont.Json.t;
metadata : metadata;
tags : tag list;
attempt : int;
max_attempts : int;
priority : priority;
errors : error_entry list;
inserted_at : Ptime.t;
scheduled_at : Ptime.t;
unique_key : string option;
attempted_at : Ptime.t option;
finalized_at : Ptime.t option;
revision : int64;
attempted_by : string option;
}val create :
?queue:queue ->
?metadata:metadata ->
?tags:tag list ->
?max_attempts:int ->
?priority:priority ->
?scheduled_at:Ptime.t ->
now:Ptime.t ->
worker:worker_name ->
args:Simdjsont.Json.t ->
unit ->
(spec,
[> `Args_too_large of int
| `Invalid_args
| `Invalid_max_attempts of int
| `Scheduled_in_past
| `Too_many_tags of int ])
resultCreate a spec within Limits. Tags are sorted and deduplicated.
val view : 'state t -> snapshotval inspect : packed -> snapshotval pack : 'state t -> packed