pub struct JobSvcConfig {
pub poller_config: JobPollerConfig,
pub clock: ClockHandle,
/* private fields */
}Expand description
Configuration consumed by Jobs::init.
Build with JobSvcConfig::builder.
§Examples
Build a configuration that manages its own Postgres pool from a connection string:
use job::{Jobs, JobSvcConfig};
use job::error::JobError;
let config = JobSvcConfig::builder()
.pg_con("postgres://postgres:password@localhost/postgres")
.build()
.unwrap();
let mut jobs = Jobs::init(config).await?;
jobs.start_poll().await?;Reuse an existing sqlx::PgPool instead:
use job::{Jobs, JobSvcConfig};
use job::error::JobError;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect_lazy("postgres://postgres:password@localhost/postgres")?;
let config = JobSvcConfig::builder()
.pool(pool)
.exec_migrations(false) // migrations already handled elsewhere
.build()
.unwrap();
let mut jobs = Jobs::init(config).await?;
jobs.start_poll().await?;Fields§
§poller_config: JobPollerConfigOverride the defaults that control how the background poller distributes work across processes.
clock: ClockHandleClock handle for time operations. Defaults to the global clock. The global clock is realtime unless an artificial clock was installed.
Implementations§
Source§impl JobSvcConfig
impl JobSvcConfig
Sourcepub fn builder() -> JobSvcConfigBuilder
pub fn builder() -> JobSvcConfigBuilder
Create a JobSvcConfigBuilder with defaults for all optional settings.
Trait Implementations§
Source§impl Clone for JobSvcConfig
impl Clone for JobSvcConfig
Source§fn clone(&self) -> JobSvcConfig
fn clone(&self) -> JobSvcConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for JobSvcConfig
impl !RefUnwindSafe for JobSvcConfig
impl Send for JobSvcConfig
impl Sync for JobSvcConfig
impl Unpin for JobSvcConfig
impl !UnwindSafe for JobSvcConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more