reifydb_sub_task/
registry.rs1use std::{sync::Arc, time::Instant};
2
3use dashmap::DashMap;
4
5use crate::task::{ScheduledTask, TaskId};
6
7#[derive(Debug, Clone)]
9pub struct TaskEntry {
10 pub task: Arc<ScheduledTask>,
12 pub next_execution: Instant,
14}
15
16pub type TaskRegistry = Arc<DashMap<TaskId, TaskEntry>>;
18
19#[derive(Debug, Clone)]
21pub struct TaskInfo {
22 pub id: TaskId,
23 pub name: String,
24 pub next_execution: Instant,
25}
26
27impl TaskInfo {
28 pub fn from_entry(id: TaskId, entry: &TaskEntry) -> Self {
29 Self {
30 id,
31 name: entry.task.name.clone(),
32 next_execution: entry.next_execution,
33 }
34 }
35}