pub struct JobBuilder<P> { /* private fields */ }Expand description
Fluent builder for a scheduled Job.
Requires Self::name before Self::build. Identity is optional via
Self::with_actor_json (default remains Job::new’s Null).
§Errors
Fallible setters and Self::build return ChrononError variants documented on each method.
Error messages must not embed full actor_json or params_json payloads.
Implementations§
Source§impl<P> JobBuilder<P>where
P: Serialize,
impl<P> JobBuilder<P>where
P: Serialize,
Sourcepub fn new(handle: &ScriptHandle<P>) -> JobBuilder<P>
pub fn new(handle: &ScriptHandle<P>) -> JobBuilder<P>
Create a new job builder for the given script handle.
Sourcepub fn name(self, name: impl Into<String>) -> JobBuilder<P>
pub fn name(self, name: impl Into<String>) -> JobBuilder<P>
Set the job name (unique per deployment).
Sourcepub fn with_actor_json(self, actor_json: Value) -> JobBuilder<P>
pub fn with_actor_json(self, actor_json: Value) -> JobBuilder<P>
Set opaque identity JSON persisted on Job::actor_json.
Use an identity snapshot only — do not store secrets. Unified Field hosts with Valence
should prefer L1 chronon_coordinator::JobBuilder::with_valence instead.
Sourcepub fn cron(self, expr: &str) -> Result<JobBuilder<P>, ChrononError>
pub fn cron(self, expr: &str) -> Result<JobBuilder<P>, ChrononError>
Set the cron schedule.
§Errors
Returns ChrononError::InvalidCron when expr is not a valid cron expression.
Sourcepub fn timezone(self, tz: impl Into<String>) -> JobBuilder<P>
pub fn timezone(self, tz: impl Into<String>) -> JobBuilder<P>
Set the timezone for cron evaluation.
Sourcepub const fn run_once_at(self, at: DateTime<Utc>) -> JobBuilder<P>
pub const fn run_once_at(self, at: DateTime<Utc>) -> JobBuilder<P>
Schedule a one-time execution at the specified time.
Sourcepub const fn manual(self) -> JobBuilder<P>
pub const fn manual(self) -> JobBuilder<P>
Set the job to manual-only (no automatic scheduling).
Sourcepub fn params(self, params: P) -> JobBuilder<P>
pub fn params(self, params: P) -> JobBuilder<P>
Set the script parameters.
Sourcepub fn pool(self, pool: impl Into<String>) -> JobBuilder<P>
pub fn pool(self, pool: impl Into<String>) -> JobBuilder<P>
Set the execution pool (for distributed mode).
Sourcepub fn region(self, region: impl Into<String>) -> JobBuilder<P>
pub fn region(self, region: impl Into<String>) -> JobBuilder<P>
Set the target region (for distributed mode).
Sourcepub const fn concurrency(self, max: i32) -> JobBuilder<P>
pub const fn concurrency(self, max: i32) -> JobBuilder<P>
Set maximum concurrent runs.
Sourcepub const fn timeout_ms(self, ms: i64) -> JobBuilder<P>
pub const fn timeout_ms(self, ms: i64) -> JobBuilder<P>
Set execution timeout in milliseconds.
Sourcepub const fn retry_policy(self, policy: RetryPolicy) -> JobBuilder<P>
pub const fn retry_policy(self, policy: RetryPolicy) -> JobBuilder<P>
Set the retry policy for failed runs.
Sourcepub const fn misfire_policy(self, policy: MisfirePolicy) -> JobBuilder<P>
pub const fn misfire_policy(self, policy: MisfirePolicy) -> JobBuilder<P>
Set the misfire policy for missed runs.
Sourcepub const fn disabled(self) -> JobBuilder<P>
pub const fn disabled(self) -> JobBuilder<P>
Disable the job (it won’t run until enabled).
Sourcepub fn build(self) -> Result<Job, ChrononError>
pub fn build(self) -> Result<Job, ChrononError>
Build the final Job payload.
§Errors
ChrononError::ParamErrorwhenSelf::namewas not setChrononError::InvalidCron/ChrononError::InvalidTimezonewhen cron fields are invalidChrononError::ParamErrorwhen params fail to serialize
Auto Trait Implementations§
impl<P> Freeze for JobBuilder<P>
impl<P> RefUnwindSafe for JobBuilder<P>where
Option<P>: RefUnwindSafe,
impl<P> Send for JobBuilder<P>
impl<P> Sync for JobBuilder<P>
impl<P> Unpin for JobBuilder<P>
impl<P> UnsafeUnpin for JobBuilder<P>where
Option<P>: UnsafeUnpin,
impl<P> UnwindSafe for JobBuilder<P>where
Option<P>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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