blob: a19525cc4e25392f9cc2516fb0e197ebf75b30e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::CronError;
use async_trait::async_trait;
pub trait CronHandler {
type EH: CronHandle + 'static;
fn create(&self, spec: CronSpec) -> Result<Self::EH, CronError>;
}
#[async_trait(?Send)]
pub trait CronHandle {
async fn next(&self, prev_success: bool) -> Result<bool, CronError>;
fn close(&self);
}
#[derive(Clone)]
pub struct CronSpec {
pub name: String,
pub cron_schedule: String,
pub backoff_schedule: Option<Vec<u32>>,
}
|