Liking cljdoc? Tell your friends :D

dev.skivi.job-history.core

Job execution history: database persistence and in-memory ring buffer.

The ring buffer retains the last N terminal records (completed, failed, partial_success). record-start! writes to the DB only; the terminal record-* functions write to the DB and push to the buffer. observe! adds directly to the buffer without any DB interaction - useful for tests and for wiring up monitoring-event subscribers.

Thread safety: the ring buffer state lives in an atom updated with swap!.

Job execution history: database persistence and in-memory ring buffer.

The ring buffer retains the last N terminal records (completed, failed,
partial_success). record-start! writes to the DB only; the terminal
record-* functions write to the DB and push to the buffer. observe! adds
directly to the buffer without any DB interaction - useful for tests and
for wiring up monitoring-event subscribers.

Thread safety: the ring buffer state lives in an atom updated with swap!.
raw docstring

create-storeclj

(create-store pool)
(create-store pool config)

Creates a history store backed by pool with optional config map. pool may be nil for pure in-memory use (ring buffer only, no DB operations). config keys: :buffer-size (default 1000), :history-retention (default '30 days').

Creates a history store backed by pool with optional config map.
pool may be nil for pure in-memory use (ring buffer only, no DB operations).
config keys: :buffer-size (default 1000), :history-retention (default '30 days').
sourceraw docstring

expire!clj

(expire! store)

Deletes history records whose expires_at has passed. Returns count deleted.

Deletes history records whose expires_at has passed. Returns count deleted.
sourceraw docstring

get-by-correlation-idclj

(get-by-correlation-id store correlation-id)

Returns all history records for correlation-id.

Returns all history records for correlation-id.
sourceraw docstring

get-by-job-idclj

(get-by-job-id store job-id)

Returns all history records for job-id, newest first.

Returns all history records for job-id, newest first.
sourceraw docstring

observe!clj

(observe! store history-record)

Adds history-record directly to the ring buffer. No DB interaction. Use for testing, or to wire up monitoring event subscribers.

Adds history-record directly to the ring buffer. No DB interaction.
Use for testing, or to wire up monitoring event subscribers.
sourceraw docstring

queryclj

(query store criteria)

Returns history records matching criteria map from the database. Criteria keys (all optional): :from, :to (inst?), :task-identifier, :status, :limit (default 100).

Returns history records matching criteria map from the database.
Criteria keys (all optional): :from, :to (inst?), :task-identifier,
:status, :limit (default 100).
sourceraw docstring

recentclj

(recent store)
(recent store n)

Returns records from the in-memory ring buffer in insertion order. With n, returns the last n records. No DB access.

Returns records from the in-memory ring buffer in insertion order.
With n, returns the last n records. No DB access.
sourceraw docstring

record-completion!clj

(record-completion! store job-id worker-id correlation-id execution-time-ms)

Writes job completion to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.

Writes job completion to the database and adds the record to the ring buffer.
Returns the updated HistoryRecord.
sourceraw docstring

record-failure!clj

(record-failure! store job-id worker-id correlation-id execution-time-ms error)

Writes job failure to the database and adds the record to the ring buffer. error may be a Throwable or a string. Returns the updated HistoryRecord.

Writes job failure to the database and adds the record to the ring buffer.
error may be a Throwable or a string. Returns the updated HistoryRecord.
sourceraw docstring

record-partial-success!clj

(record-partial-success! store
                         job-id
                         worker-id
                         correlation-id
                         execution-time-ms
                         partial-results)

Writes partial success to the database and adds the record to the ring buffer. Returns the updated HistoryRecord.

Writes partial success to the database and adds the record to the ring buffer.
Returns the updated HistoryRecord.
sourceraw docstring

record-start!clj

(record-start! store job worker-id correlation-id)
(record-start! store job worker-id correlation-id opts)

Writes job execution start to the database. Does not add to ring buffer. Returns the created HistoryRecord. opts key: :history-retention (interval string).

Writes job execution start to the database. Does not add to ring buffer.
Returns the created HistoryRecord. opts key: :history-retention (interval string).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close