pub struct Queue { /* private fields */ }Expand description
The queue itself, which consists of the SQLite connection and tasks to monitor running jobs.
Implementations§
Source§impl Queue
impl Queue
Sourcepub async fn add_jobs(&self, jobs: Vec<Job>) -> Result<Vec<Uuid>>
pub async fn add_jobs(&self, jobs: Vec<Job>) -> Result<Vec<Uuid>>
Submit multiple jobs to the queue
Sourcepub async fn update_job(&self, job: JobUpdate) -> Result<()>
pub async fn update_job(&self, job: JobUpdate) -> Result<()>
Update some aspects of a job. Jobs can not be updated while running or after they have finished.
Sourcepub async fn cancel_job(&self, job_id: Uuid) -> Result<()>
pub async fn cancel_job(&self, job_id: Uuid) -> Result<()>
Cancel a job. Jobs can not be cancelled while are running or after they have finished.
Source§impl Queue
impl Queue
Sourcepub async fn get_job_status(&self, external_id: Uuid) -> Result<JobStatus>
pub async fn get_job_status(&self, external_id: Uuid) -> Result<JobStatus>
Return information about a job
Sourcepub async fn get_jobs_by_name(
&self,
name: String,
limit: usize,
) -> Result<Vec<JobStatus>>
pub async fn get_jobs_by_name( &self, name: String, limit: usize, ) -> Result<Vec<JobStatus>>
Get jobs by their name, ordered by the most recently added.
Sourcepub async fn num_active_jobs(&self) -> Result<NumActiveJobs>
pub async fn num_active_jobs(&self) -> Result<NumActiveJobs>
Return counts about the number of jobs running and waiting to run.
Source§impl Queue
impl Queue
Sourcepub async fn new(file: &Path) -> Result<Queue>
pub async fn new(file: &Path) -> Result<Queue>
Open or create a Queue database at the given path.
Sourcepub fn builder(path: &Path) -> QueueOptions<'_>
pub fn builder(path: &Path) -> QueueOptions<'_>
Create a builder object for a Queue
Sourcepub async fn with_options(options: QueueOptions<'_>) -> Result<Queue>
pub async fn with_options(options: QueueOptions<'_>) -> Result<Queue>
Open or create a Queue database with the given [LocalQueueOptions].
Source§impl Queue
impl Queue
Sourcepub async fn add_recurring_job(
&self,
id: String,
schedule: RecurringJobSchedule,
job: Job,
run_immediately: bool,
) -> Result<(), Error>
pub async fn add_recurring_job( &self, id: String, schedule: RecurringJobSchedule, job: Job, run_immediately: bool, ) -> Result<(), Error>
Add a new recurring job to the queue, returning an error if a job with this external ID already exists.
Sourcepub async fn update_recurring_job(
&self,
id: String,
schedule: RecurringJobSchedule,
job: Job,
) -> Result<(), Error>
pub async fn update_recurring_job( &self, id: String, schedule: RecurringJobSchedule, job: Job, ) -> Result<(), Error>
Update a recurring job. Returns an error if the job does not exist.
Sourcepub async fn upsert_recurring_job(
&self,
id: String,
schedule: RecurringJobSchedule,
job: Job,
run_immediately_on_insert: bool,
) -> Result<(), Error>
pub async fn upsert_recurring_job( &self, id: String, schedule: RecurringJobSchedule, job: Job, run_immediately_on_insert: bool, ) -> Result<(), Error>
Add a new recurring job, or update an existing one.
Sourcepub async fn delete_recurring_job(&self, id: String) -> Result<(), Error>
pub async fn delete_recurring_job(&self, id: String) -> Result<(), Error>
Remove a recurring job and unschedule any scheduled jobs for it.
Sourcepub async fn get_recurring_job_info(
&self,
id: String,
) -> Result<RecurringJobInfo, Error>
pub async fn get_recurring_job_info( &self, id: String, ) -> Result<RecurringJobInfo, Error>
Return information about a recurring job and its latest execution