ElixirTalk v1.2.0 ElixirTalk
ElixirTalk - A beanstalkd client coding with Elixir
from Copyright 2014-2016 by jsvisa(delweng@gmail.com)
Summary
Functions
Put a job into the “buried” state. Buried jobs are put into a
FIFO linked list and will not be touched by the server again until a client
kicks them with the kick
command
Connect to the beanstalkd server
Remove a job from the server entirely. It is normally used by the client when the job has successfully run to completion. A client can delete jobs that it has reserved, ready jobs, delayed jobs, and jobs that are buried
Remove the named tube from the watch list for the current connection
Move jobs into the ready queue. If there are any buried jobs, it will only kick buried jobs. Otherwise it will kick delayed jobs
Similar to kick(bound)
, if the given job id exists and is in a buried or
delayed state, it will be moved to the ready queue of the the same tube where it
currently belongs
Return the tube currently being used by the client
Return a list of all existing tubes in the server
Return the tubes currently being watched by the client
Delay any new job being reserved for a given time
Let the client inspect a job in the system. Peeking the given job id
Peeking the next job in the list of buried jobs
Peeking the delayed job with the shortest delay left
Peeking the next ready job
Put a job to the current tube
Close the connection to server
Put a reserved job back into the ready queue (and marks its state as “ready”) to be run by any client. It is normally used when the job fails because of a transitory error
Get a job from the currently watched tubes
Get a job from the currently watched tubes with timeout of seconds
Give statistical information about the system as a whole
Similar to stats/0
, gives statistical information about the specified job if
it exists
Similar to stats/0
, gives statistical information about the specified tube
if it exists
Allow a worker to request more time to work on a job. This is useful for jobs that potentially take a long time, but you still want the benefits of a TTR pulling a job away from an unresponsive worker. A worker may periodically tell the server that it’s still alive and processing a job (e.g. it may do this on DEADLINE_SOON). The command postpones the auto release of a reserved job until TTR seconds from when the command is issued
Use a tube to put
jobs
Add the named tube to the watch list for the current connection. A reserve command will take a job from any of the tubes in the watch list
Types
connection_error :: :timeout | :closed | :inet.posix
result ::
{:inserted, non_neg_integer} |
{:buried, non_neg_integer} |
{:expected_crlf} |
:job_too_big |
:draining |
connection_error
Functions
Specs
bury(pid, non_neg_integer, non_neg_integer) ::
:buried |
:not_found |
connection_error
Put a job into the “buried” state. Buried jobs are put into a
FIFO linked list and will not be touched by the server again until a client
kicks them with the kick
command.
Specs
connect(List.t) :: {:ok, pid} | {:error, term}
Connect to the beanstalkd server.
Specs
connect(:inet.ip_address | :inet.hostname, integer, timeout) ::
{:ok, pid} |
{:error, term}
Specs
delete(pid, non_neg_integer) ::
:deleted |
:not_found |
connection_error
Remove a job from the server entirely. It is normally used by the client when the job has successfully run to completion. A client can delete jobs that it has reserved, ready jobs, delayed jobs, and jobs that are buried.
Specs
ignore(pid, String.t) ::
{:watching, non_neg_integer} |
:not_ignored |
connection_error
Remove the named tube from the watch list for the current connection.
Specs
kick(pid, non_neg_integer) ::
{:kicked, non_neg_integer} |
connection_error
Move jobs into the ready queue. If there are any buried jobs, it will only kick buried jobs. Otherwise it will kick delayed jobs.
Apply only to the currently used tube.
Specs
kick_job(pid, non_neg_integer) ::
:kicked |
:not_found |
connection_error
Similar to kick(bound)
, if the given job id exists and is in a buried or
delayed state, it will be moved to the ready queue of the the same tube where it
currently belongs.
Specs
list_tube_used(pid) ::
{:using, String.t} |
connection_error
Return the tube currently being used by the client.
Specs
list_tubes(pid) :: list | connection_error
Return a list of all existing tubes in the server.
Specs
list_tubes_watched(pid) :: list | connection_error
Return the tubes currently being watched by the client.
Specs
pause_tube(pid, String.t, non_neg_integer) ::
:paused |
:not_found |
connection_error
Delay any new job being reserved for a given time.
Specs
peek(pid, non_neg_integer) ::
{:found, non_neg_integer} |
:not_found |
connection_error
Let the client inspect a job in the system. Peeking the given job id
Specs
peek_buried(pid) ::
{:found, non_neg_integer} |
:not_found |
connection_error
Peeking the next job in the list of buried jobs.
Specs
peek_delayed(pid) ::
{:found, non_neg_integer} |
:not_found |
connection_error
Peeking the delayed job with the shortest delay left.
Specs
peek_ready(pid) ::
{:found, non_neg_integer} |
:not_found |
connection_error
Peeking the next ready job.
Put a job to the current tube.
The opts can be any combination of
:pri
- an integer < 2**32. Jobs with smaller priority values will be scheduled before jobs with larger priorities. The most urgent priority is 0; the least urgent priority is 4,294,967,295.:delay
- an integer number of seconds to wait before putting the job in the ready queue. The job will be in the “delayed” state during this time.:ttr
-time to run — is an integer number of seconds to allow a worker to run this job. This time is counted from the moment a worker reserves this job. If the worker does not delete, release, or bury the job within:ttr
seconds, the job will time out and the server will release the job. The minimum ttr is 1. If the client sends 0, the server will silently increase the ttr to 1.
Specs
release(pid, non_neg_integer, pri: integer, delay: integer) ::
:released |
:buried |
:not_found |
connection_error
Put a reserved job back into the ready queue (and marks its state as “ready”) to be run by any client. It is normally used when the job fails because of a transitory error.
The opts can any combination of
:pri
- a new priority to assign to the job;:delay
- an integer number of seconds to wait before putting the job back in the ready queue. The job will be in the “delayed” state during this time.
Specs
reserve(pid) ::
{:reserved, non_neg_integer, String.t} |
connection_error
Get a job from the currently watched tubes.
Specs
reserve(pid, non_neg_integer) ::
{:reserved, non_neg_integer, String.t} |
:deadline_soon |
:timed_out |
connection_error
Get a job from the currently watched tubes with timeout of seconds.
Specs
stats(pid) :: Map.t | connection_error
Give statistical information about the system as a whole.
Specs
stats_job(pid, non_neg_integer) ::
Map.t |
:not_found |
connection_error
Similar to stats/0
, gives statistical information about the specified job if
it exists.
Specs
stats_tube(pid, String.t) ::
Map.t |
:not_found |
connection_error
Similar to stats/0
, gives statistical information about the specified tube
if it exists.
Specs
touch(pid, non_neg_integer) ::
:touched |
:not_found |
connection_error
Allow a worker to request more time to work on a job. This is useful for jobs that potentially take a long time, but you still want the benefits of a TTR pulling a job away from an unresponsive worker. A worker may periodically tell the server that it’s still alive and processing a job (e.g. it may do this on DEADLINE_SOON). The command postpones the auto release of a reserved job until TTR seconds from when the command is issued.
Specs
use(pid, String.t) ::
{:using, String.t} |
connection_error
Use a tube to put
jobs.
Specs
watch(pid, String.t) ::
{:watching, non_neg_integer} |
connection_error
Add the named tube to the watch list for the current connection. A reserve command will take a job from any of the tubes in the watch list.