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