mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-27 22:41:00 +00:00
Oops, fix doc links
This commit is contained in:
parent
843b5407e8
commit
803a242a46
5 changed files with 11 additions and 10 deletions
|
@ -1,10 +1,11 @@
|
||||||
[package]
|
[package]
|
||||||
name = "background-jobs"
|
name = "background-jobs"
|
||||||
description = "Background Jobs implemented with tokio and futures"
|
description = "Background Jobs implemented with tokio and futures"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/asonix/background-jobs"
|
repository = "https://git.asonix.dog/asonix/background-jobs"
|
||||||
|
readme = "README.md"
|
||||||
keywords = ["jobs", "processor"]
|
keywords = ["jobs", "processor"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "background-jobs-core"
|
name = "background-jobs-core"
|
||||||
description = "Core types for implementing an asynchronous jobs processor on tokio"
|
description = "Core types for implementing an asynchronous jobs processor on tokio"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/asonix/background-jobs"
|
repository = "https://git.asonix.dog/asonix/background-jobs"
|
||||||
|
|
|
@ -27,7 +27,7 @@ use crate::{Backoff, JobStatus, MaxRetries, ShouldStop};
|
||||||
///
|
///
|
||||||
/// Although exposed publically, this type should only really be handled by the library itself, and
|
/// Although exposed publically, this type should only really be handled by the library itself, and
|
||||||
/// is impossible to create outside of a
|
/// is impossible to create outside of a
|
||||||
/// [Processor](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Processor)'s new_job
|
/// [Processor](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Processor)'s new_job
|
||||||
/// method.
|
/// method.
|
||||||
pub struct JobInfo {
|
pub struct JobInfo {
|
||||||
/// ID of the job, None means an ID has not been set
|
/// ID of the job, None means an ID has not been set
|
||||||
|
|
|
@ -33,10 +33,10 @@ use crate::{Backoff, Job, JobError, JobInfo, MaxRetries};
|
||||||
/// - The job's default queue
|
/// - The job's default queue
|
||||||
/// - The job's default maximum number of retries
|
/// - The job's default maximum number of retries
|
||||||
/// - The job's [backoff
|
/// - The job's [backoff
|
||||||
/// strategy](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Backoff)
|
/// strategy](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Backoff)
|
||||||
///
|
///
|
||||||
/// Processors also provide the default mechanism for running a job, and the only mechanism for
|
/// Processors also provide the default mechanism for running a job, and the only mechanism for
|
||||||
/// creating a [JobInfo](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.JobInfo),
|
/// creating a [JobInfo](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.JobInfo),
|
||||||
/// which is the type required for queuing jobs to be executed.
|
/// which is the type required for queuing jobs to be executed.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
|
@ -160,7 +160,7 @@ pub trait Processor: Clone {
|
||||||
/// Patterns like this could be useful if you want to use the same job type for multiple
|
/// Patterns like this could be useful if you want to use the same job type for multiple
|
||||||
/// scenarios. Defining the `process` method for multiple `Processor`s with different
|
/// scenarios. Defining the `process` method for multiple `Processor`s with different
|
||||||
/// before/after logic for the same
|
/// before/after logic for the same
|
||||||
/// [`Job`](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Job) type is
|
/// [`Job`](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Job) type is
|
||||||
/// supported.
|
/// supported.
|
||||||
fn process(&self, args: Value) -> Box<dyn Future<Item = (), Error = JobError> + Send> {
|
fn process(&self, args: Value) -> Box<dyn Future<Item = (), Error = JobError> + Send> {
|
||||||
let res = serde_json::from_value::<Self::Job>(args);
|
let res = serde_json::from_value::<Self::Job>(args);
|
||||||
|
|
|
@ -27,16 +27,16 @@ use crate::{JobError, JobInfo, Processor};
|
||||||
/// A generic function that processes a job
|
/// A generic function that processes a job
|
||||||
///
|
///
|
||||||
/// Instead of storing
|
/// Instead of storing
|
||||||
/// [`Processor`](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Processor) type
|
/// [`Processor`](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Processor) type
|
||||||
/// directly, the
|
/// directly, the
|
||||||
/// [`ProcessorMap`](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.ProcessorMap)
|
/// [`ProcessorMap`](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.ProcessorMap)
|
||||||
/// struct stores these `ProcessFn` types that don't expose differences in Job types.
|
/// struct stores these `ProcessFn` types that don't expose differences in Job types.
|
||||||
pub type ProcessFn =
|
pub type ProcessFn =
|
||||||
Box<dyn Fn(Value) -> Box<dyn Future<Item = (), Error = JobError> + Send> + Send + Sync>;
|
Box<dyn Fn(Value) -> Box<dyn Future<Item = (), Error = JobError> + Send> + Send + Sync>;
|
||||||
|
|
||||||
/// A type for storing the relationships between processor names and the processor itself
|
/// A type for storing the relationships between processor names and the processor itself
|
||||||
///
|
///
|
||||||
/// [`Processor`s](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Processor) must be
|
/// [`Processor`s](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Processor) must be
|
||||||
/// registered with the `ProcessorMap` in the initialization phase of an application before
|
/// registered with the `ProcessorMap` in the initialization phase of an application before
|
||||||
/// workers are spawned in order to handle queued jobs.
|
/// workers are spawned in order to handle queued jobs.
|
||||||
pub struct ProcessorMap {
|
pub struct ProcessorMap {
|
||||||
|
@ -50,7 +50,7 @@ impl ProcessorMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register a
|
/// Register a
|
||||||
/// [`Processor`](https://docs.rs/background-jobs/0.1.0/background_jobs/struct.Processor) with
|
/// [`Processor`](https://docs.rs/background-jobs/0.1.1/background_jobs/struct.Processor) with
|
||||||
/// this `ProcessorMap`.
|
/// this `ProcessorMap`.
|
||||||
///
|
///
|
||||||
/// `ProcessorMap`s are useless if no processors are registerd before workers are spawned, so
|
/// `ProcessorMap`s are useless if no processors are registerd before workers are spawned, so
|
||||||
|
|
Loading…
Reference in a new issue