Que v0.10.0 Que.Persistence behaviour View Source
Provides a high-level API to interact with Jobs in Database
This module is a behaviour that delegates calls to the specified
adapter. It has been designed in a way that it's easy to write
custom adapters for other databases or stores like Redis, even
though there are no current plans on supporting anything other
than Mnesia
.
Link to this section Summary
Functions
See Que.Persistence.Mnesia.all/0
.
See Que.Persistence.Mnesia.all/1
.
See Que.Persistence.Mnesia.completed/0
.
See Que.Persistence.Mnesia.completed/1
.
See Que.Persistence.Mnesia.destroy/1
.
See Que.Persistence.Mnesia.failed/0
.
See Que.Persistence.Mnesia.failed/1
.
See Que.Persistence.Mnesia.find/1
.
See Que.Persistence.Mnesia.incomplete/0
.
See Que.Persistence.Mnesia.incomplete/1
.
See Que.Persistence.Mnesia.initialize/0
.
See Que.Persistence.Mnesia.insert/1
.
See Que.Persistence.Mnesia.update/1
.
Callbacks
Returns all Que.Job
s for the given worker.
Returns completed Que.Job
s from the database.
Returns completed Que.Job
s for the given worker.
Deletes a Que.Job
from the database.
Returns failed Que.Job
s for the given worker.
Returns incomplete Que.Job
s from the database.
Returns incomplete Que.Job
s for the given worker.
Makes sure that the Database is ready to be used.
Inserts a Que.Job
into the database.
Updates an existing Que.Job
in the database.
Link to this section Functions
See Que.Persistence.Mnesia.all/0
.
all(worker) View Source
See Que.Persistence.Mnesia.all/1
.
completed() View Source
See Que.Persistence.Mnesia.completed/0
.
completed(worker) View Source
See Que.Persistence.Mnesia.completed/1
.
destroy(id) View Source
See Que.Persistence.Mnesia.destroy/1
.
failed() View Source
See Que.Persistence.Mnesia.failed/0
.
failed(worker) View Source
See Que.Persistence.Mnesia.failed/1
.
find(id) View Source
See Que.Persistence.Mnesia.find/1
.
incomplete() View Source
See Que.Persistence.Mnesia.incomplete/0
.
incomplete(worker) View Source
See Que.Persistence.Mnesia.incomplete/1
.
initialize() View Source
See Que.Persistence.Mnesia.initialize/0
.
insert(job) View Source
See Que.Persistence.Mnesia.insert/1
.
update(job) View Source
See Que.Persistence.Mnesia.update/1
.
Link to this section Callbacks
all()
View Source
all() :: [Que.Job.t()]
all() :: [Que.Job.t()]
Returns all Que.Job
s in the database.
all(worker)
View Source
all(worker :: Que.Worker.t()) :: [Que.Job.t()]
all(worker :: Que.Worker.t()) :: [Que.Job.t()]
Returns all Que.Job
s for the given worker.
completed()
View Source
completed() :: [Que.Job.t()]
completed() :: [Que.Job.t()]
Returns completed Que.Job
s from the database.
completed(worker)
View Source
completed(worker :: Que.Worker.t()) :: [Que.Job.t()]
completed(worker :: Que.Worker.t()) :: [Que.Job.t()]
Returns completed Que.Job
s for the given worker.
destroy(id) View Source
Deletes a Que.Job
from the database.
failed()
View Source
failed() :: [Que.Job.t()]
failed() :: [Que.Job.t()]
Returns failed Que.Job
s from the database.
failed(worker)
View Source
failed(worker :: Que.Worker.t()) :: [Que.Job.t()]
failed(worker :: Que.Worker.t()) :: [Que.Job.t()]
Returns failed Que.Job
s for the given worker.
find(id) View Source
Finds a Que.Job
from the database.
Returns the a Job struct if it's found, otherwise nil
.
incomplete()
View Source
incomplete() :: [Que.Job.t()]
incomplete() :: [Que.Job.t()]
Returns incomplete Que.Job
s from the database.
This includes all Jobs whose status is either
:queued
or :started
but not :failed
.
incomplete(worker)
View Source
incomplete(worker :: Que.Worker.t()) :: [Que.Job.t()]
incomplete(worker :: Que.Worker.t()) :: [Que.Job.t()]
Returns incomplete Que.Job
s for the given worker.
initialize()
View Source
initialize() :: :ok | :error
initialize() :: :ok | :error
Makes sure that the Database is ready to be used.
This is called when the Que application, specifically
Que.Server
, starts to make sure that a database exists
and is ready to be used.
insert(job) View Source
Inserts a Que.Job
into the database.
Returns the same Job struct with the id
value set
update(job) View Source
Updates an existing Que.Job
in the database.
This methods finds the job to update by the given job's id. If no job with the given id exists, it is inserted as-is. If the id of the given job is nil, it's still inserted and a valid id is assigned.
Returns the updated job.