Struct disque::Disque [] [src]

pub struct Disque {
    // some fields omitted
}

Methods

impl Disque
[src]

fn open<T: IntoConnectionInfo>(params: T) -> RedisResult<Disque>

Opens a new connection to a Disque server.

Examples

let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();

fn hello(&self) -> RedisResult<(u8, String, Vec<(String, String, u16, u32)>)>

The hello command returns information about the disque cluster.

Examples

let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
let (_, nodeid, _) = disque.hello().unwrap();
println!("Connected to node {}", nodeid);

fn addjob(&self, queue_name: &[u8], job: &[u8], timeout: Duration, replicate: Option<usize>, delay: Option<Duration>, retry: Option<Duration>, ttl: Option<Duration>, maxlen: Option<usize>, async: bool) -> RedisResult<String>

Adds a job to a queue.

Examples

let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
let jobid = disque.addjob(b"my queue", b"my job",
  Duration::from_secs(10), None, None, None, None, None, false
  ).unwrap();
println!("My job id is {}", jobid);

fn getjob_count(&self, nohang: bool, timeout: Option<Duration>, count: usize, queues: &[&[u8]]) -> RedisResult<Vec<(Vec<u8>, String, Vec<u8>)>>

Gets up to count jobs from certain queues.

Examples

let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
let queue = b"my getjob_count queue";
disque.addjob(queue, b"my job 1", Duration::from_secs(10),
  None, None, None, None, None, false
  ).unwrap();
disque.addjob(queue, b"my job 2", Duration::from_secs(10),
  None, None, None, None, None, false
  ).unwrap();

let jobs = disque.getjob_count(true, None, 10, &[queue]).unwrap();
assert_eq!(jobs.len(), 2);
assert_eq!(jobs[0].2, b"my job 1");
assert_eq!(jobs[1].2, b"my job 2");

fn getjob_count_withcounters(&self, nohang: bool, timeout: Option<Duration>, count: usize, queues: &[&[u8]]) -> RedisResult<Vec<(Vec<u8>, String, Vec<u8>, u32, u32)>>

fn getjob(&self, nohang: bool, timeout: Option<Duration>, queues: &[&[u8]]) -> RedisResult<Option<(Vec<u8>, String, Vec<u8>)>>

Gets a single job from any of the specified queues.

fn getjob_withcounters(&self, nohang: bool, timeout: Option<Duration>, queues: &[&[u8]]) -> RedisResult<Option<(Vec<u8>, String, Vec<u8>, u32, u32)>>

Gets a single job from any of the specified queues with its nack and additional deliveries count.

fn ackjobs(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Acknowledge jobs.

fn ackjob(&self, jobid: &[u8]) -> RedisResult<bool>

Acknowledge a job.

fn fastackjobs(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Fast acknowledge jobs.

fn fastackjob(&self, jobid: &[u8]) -> RedisResult<bool>

Fast acknowledge a job.

fn working(&self, jobid: &[u8]) -> RedisResult<Duration>

Tell Disque that a job is still processed.

fn nackjobs(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Tells Disque to put back the jobs in the queue ASAP. Should be used when the worker was not able to process a message and wants the message to be put back into the queue in order to be processed again.

fn nackjob(&self, jobid: &[u8]) -> RedisResult<bool>

Tells Disque to put back a job in the queue ASAP.

fn info(&self) -> RedisResult<InfoDict>

Information about the server

fn qlen(&self, queue_name: &[u8]) -> RedisResult<usize>

Size of the queue

fn qpeek(&self, queue_name: &[u8], count: i64) -> RedisResult<Vec<Vec<Vec<u8>>>>

Gets jobs from queue_name up to the absolute number of count. If count is negative, it will be from newest to oldest.

fn enqueue(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Add jobs to queues

fn dequeue(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Remove jobs from queue

fn deljobs(&self, jobids: &[&[u8]]) -> RedisResult<usize>

Completely delete jobs from a single node.

fn deljob(&self, jobid: &[u8]) -> RedisResult<bool>

Completely delete a job from a single node.

fn show(&self, jobid: &[u8]) -> RedisResult<Option<HashMap<String, Value>>>

Returns full information about a job, like its current state and data.

fn qscan(&self, cursor: u64, count: u64, busyloop: bool, minlen: Option<u64>, maxlen: Option<u64>, importrate: Option<u64>) -> RedisResult<Iter<Vec<u8>>>

Iterator to run all queues that fulfil a criteria. The iterator will batch into segments of approximate count size.

fn jscan_id(&self, cursor: u64, count: u64, blocking: bool, queue: Option<&[u8]>, states: &[&str]) -> RedisResult<Iter<String>>

Iterator to run all jobs that fulfil a criteria. The iterator will batch into segments of approximate count size.