pub struct ScriptHandle<P> { /* private fields */ }Expand description
A typed handle for scheduling a script with specific parameters.
Created by the #[chronon::script] macro. The attribute turns the annotated
function into a handle factory (fn nightly_cleanup() -> ScriptHandle<…>) and
moves the body to an internal __*_impl entry point used by the executor.
Preferred scheduling: build jobs with Chronon’s fluent JobBuilder
(chronon_scheduler::JobBuilder, re-exported from the chronon / uf-chronon facade)
from this handle, then upsert via CoordinatorService or RemoteCoordinatorClient.
Self::job / Self::job_with_params only seed script_name / params_json — a
low-level alternate to the fluent builder.
§Examples
Handle identity (construction lives on Chronon JobBuilder — see
cargo run -p uf-chronon --example script_handle_job --features mem):
use chronon_core::ScriptHandle;
use serde::Serialize;
#[derive(Serialize)]
struct NightlyCleanupParams {
retention_days: u32,
}
let handle = ScriptHandle::<NightlyCleanupParams>::new("nightly_cleanup");
assert_eq!(handle.name(), "nightly_cleanup");Low-level seed (prefer JobBuilder::params in application code):
use chronon_core::{Job, ScriptHandle};
use serde::Serialize;
#[derive(Serialize)]
struct NightlyCleanupParams {
retention_days: u32,
}
let handle = ScriptHandle::<NightlyCleanupParams>::new("nightly_cleanup");
let job: Job = handle
.job_with_params(
"nightly-job",
&NightlyCleanupParams {
retention_days: 7,
},
)
.expect("params serialize");
assert_eq!(job.script_name, "nightly_cleanup");
assert_eq!(job.params_json["retention_days"], 7);Implementations§
Trait Implementations§
Source§impl<P: Clone> Clone for ScriptHandle<P>
impl<P: Clone> Clone for ScriptHandle<P>
Source§fn clone(&self) -> ScriptHandle<P>
fn clone(&self) -> ScriptHandle<P>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more