kafru/lib.rs
1use serde::{Deserialize, Serialize};
2
3/// Manages the database connection and client interactions.
4pub mod database;
5
6/// Manages the task queue, storing tasks awaiting execution.
7pub mod queue;
8
9/// Manages task definitions and execution details.
10pub mod task;
11
12/// Manages the execution and polling of tasks from the queue.
13pub mod worker;
14
15/// Manages schedule definitions for task execution.
16pub mod schedule;
17
18/// Parses CRON expressions and generates upcoming scheduled times.
19pub mod cron_schedule;
20
21/// Polls schedules and assigns tasks to the appropriate queue.
22pub mod scheduler;
23
24/// Defines metrics used by the Worker and Scheduler for tracking performance.
25pub mod metric;
26
27/// Manages the initialization and orchestration of the Worker and Scheduler.
28pub mod manager;
29
30// Unit and integration test cases for the modules.
31pub mod tests;
32
33// Agent for sending commands/signals to worker agent, scheduler agent
34pub mod agent;
35
36#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
37/// The available commands that can be send to scheduler and worker.
38pub enum Command {
39 /// Force shutdown the scheduler, it will not wait for the execution to complete.
40 SchedulerForceShutdown,
41 /// Force shutdown the scheduler, it will wait for the execution to complete.
42 SchedulerGracefulShutdown,
43 /// Resumes the paused queue.
44 QueueForceShutdown,
45 /// Force shutdown the queue, it will wait for the execution to complete.
46 QueueGracefulShutdown,
47 /// Terminate a Task.
48 TaskTerminate,
49 /// Remove a Task.
50 TaskRemove,
51}