Skip to main content

FlashQ

Struct FlashQ 

Source
pub struct FlashQ { /* private fields */ }
Expand description

flashQ client with connection pooling.

Implementations§

Source§

impl FlashQ

Source

pub fn new() -> Self

Create a new client with default options.

Source

pub fn with_options(opts: ClientOptions) -> Self

Create a new client with custom options.

Source

pub async fn connect(&self) -> Result<()>

Connect to the server.

Source

pub async fn close(&self) -> Result<()>

Close all connections.

Source

pub fn is_connected(&self) -> bool

Check if connected to the server.

Source

pub fn pool_stats(&self) -> (u64, u64, usize)

Get pool statistics: (reconnects, failures, healthy_connections).

Source

pub async fn auth(&self, token: &str) -> Result<bool>

Authenticate with the server.

Source

pub async fn ping(&self) -> Result<bool>

Ping the server.

Source

pub async fn push<T: Serialize>( &self, queue: &str, data: T, opts: Option<PushOptions>, ) -> Result<u64>

Push a job to a queue.

Source

pub async fn push_batch( &self, queue: &str, jobs: Vec<JobPayload>, ) -> Result<BatchPushResult>

Push multiple jobs to a queue.

Source

pub async fn pull( &self, queue: &str, timeout: Option<Duration>, ) -> Result<Option<Job>>

Pull a single job from a queue (blocking).

Source

pub async fn pull_batch( &self, queue: &str, count: u32, timeout: Option<Duration>, ) -> Result<Vec<Job>>

Pull multiple jobs from a queue.

Source

pub async fn ack(&self, job_id: u64, result: Option<Value>) -> Result<bool>

Acknowledge job completion with optional result.

Source

pub async fn ack_batch(&self, job_ids: Vec<u64>) -> Result<u32>

Acknowledge multiple jobs.

Source

pub async fn fail(&self, job_id: u64, error: Option<&str>) -> Result<bool>

Fail a job with optional error message.

Source§

impl FlashQ

Job query and management methods.

Source

pub async fn get_job(&self, job_id: u64) -> Result<Option<JobWithState>>

Get a job by ID with its current state.

Source

pub async fn get_state(&self, job_id: u64) -> Result<Option<JobState>>

Get job state only.

Source

pub async fn get_result(&self, job_id: u64) -> Result<Option<Value>>

Get job result.

Source

pub async fn get_job_by_custom_id( &self, custom_id: &str, ) -> Result<Option<JobWithState>>

Get job by custom ID (idempotency lookup).

Source

pub async fn get_jobs_batch( &self, job_ids: Vec<u64>, ) -> Result<Vec<JobWithState>>

Get multiple jobs by IDs.

Source

pub async fn get_jobs( &self, queue: Option<&str>, state: Option<JobState>, limit: Option<u32>, offset: Option<u32>, ) -> Result<JobsResult>

List jobs with filtering and pagination.

Source

pub async fn get_job_counts(&self, queue: &str) -> Result<JobCounts>

Get job counts by state for a queue.

Source

pub async fn count(&self, queue: &str) -> Result<u64>

Count waiting + delayed jobs in a queue.

Source

pub async fn finished( &self, job_id: u64, timeout: Option<Duration>, ) -> Result<Option<Value>>

Wait for job completion and return result (blocking).

Source

pub async fn cancel(&self, job_id: u64) -> Result<bool>

Cancel a pending job.

Source

pub async fn progress( &self, job_id: u64, progress: u8, message: Option<&str>, ) -> Result<bool>

Update job progress (0-100) with optional message.

Source

pub async fn get_progress(&self, job_id: u64) -> Result<ProgressInfo>

Get job progress.

Source

pub async fn update<T: Serialize>(&self, job_id: u64, data: T) -> Result<bool>

Update job data.

Source

pub async fn change_priority(&self, job_id: u64, priority: i32) -> Result<bool>

Change job priority.

Source

pub async fn move_to_delayed(&self, job_id: u64, delay: u64) -> Result<bool>

Move active job back to delayed state.

Source

pub async fn promote(&self, job_id: u64) -> Result<bool>

Promote delayed job to waiting.

Source

pub async fn discard(&self, job_id: u64) -> Result<bool>

Discard a job (move to DLQ).

Source

pub async fn heartbeat(&self, job_id: u64) -> Result<bool>

Send heartbeat for a long-running job.

Source

pub async fn log( &self, job_id: u64, message: &str, level: Option<&str>, ) -> Result<bool>

Add a log entry to a job.

Source

pub async fn get_logs(&self, job_id: u64) -> Result<Vec<LogEntry>>

Get job log entries.

Source

pub async fn get_children(&self, job_id: u64) -> Result<Vec<u64>>

Get child job IDs for a parent job.

Source

pub async fn partial( &self, job_id: u64, data: Value, index: Option<u32>, ) -> Result<bool>

Send partial result for streaming.

Source§

impl FlashQ

Queue management, DLQ, rate limiting, cron, flow, and monitoring methods.

Source

pub async fn pause(&self, queue: &str) -> Result<bool>

Pause a queue.

Source

pub async fn resume(&self, queue: &str) -> Result<bool>

Resume a paused queue.

Source

pub async fn is_paused(&self, queue: &str) -> Result<bool>

Check if a queue is paused.

Source

pub async fn drain(&self, queue: &str) -> Result<u64>

Drain all waiting jobs from a queue. Returns count of drained jobs.

Source

pub async fn obliterate(&self, queue: &str) -> Result<bool>

Remove ALL data for a queue (jobs, DLQ, cron, etc.).

Source

pub async fn clean( &self, queue: &str, grace: u64, state: &str, limit: Option<u32>, ) -> Result<u64>

Clean jobs older than grace period by state.

Source

pub async fn list_queues(&self) -> Result<Vec<QueueInfo>>

List all queues.

Source

pub async fn get_dlq(&self, queue: &str, count: Option<u32>) -> Result<Vec<Job>>

Get jobs from the dead letter queue.

Source

pub async fn retry_dlq(&self, queue: &str, job_id: Option<u64>) -> Result<u64>

Retry DLQ jobs. If job_id provided, retries specific job; otherwise retries all.

Source

pub async fn purge_dlq(&self, queue: &str) -> Result<u64>

Purge all jobs from dead letter queue.

Source

pub async fn set_rate_limit(&self, queue: &str, limit: u32) -> Result<bool>

Set rate limit for a queue (jobs per second).

Source

pub async fn clear_rate_limit(&self, queue: &str) -> Result<bool>

Clear rate limit for a queue.

Source

pub async fn set_concurrency(&self, queue: &str, limit: u32) -> Result<bool>

Set concurrency limit for a queue.

Source

pub async fn clear_concurrency(&self, queue: &str) -> Result<bool>

Clear concurrency limit for a queue.

Source

pub async fn add_cron(&self, name: &str, opts: CronOptions) -> Result<bool>

Add a cron job.

Source

pub async fn delete_cron(&self, name: &str) -> Result<bool>

Delete a cron job.

Source

pub async fn list_crons(&self) -> Result<Vec<CronJob>>

List all cron jobs.

Source

pub async fn push_flow<T: Serialize>( &self, queue: &str, data: T, children: Vec<FlowChild>, opts: Option<PushOptions>, ) -> Result<FlowResult>

Push a flow (parent job with children dependencies).

Source

pub async fn stats(&self) -> Result<Stats>

Get queue statistics.

Source

pub async fn metrics(&self) -> Result<Metrics>

Get detailed metrics.

Trait Implementations§

Source§

impl Default for FlashQ

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for FlashQ

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !Freeze for FlashQ

§

impl !RefUnwindSafe for FlashQ

§

impl !UnwindSafe for FlashQ

§

impl Send for FlashQ

§

impl Sync for FlashQ

§

impl Unpin for FlashQ

§

impl UnsafeUnpin for FlashQ

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more