Expand description
A3S Cron - Task scheduling library
Provides cron-based task scheduling with:
- Standard 5-field cron syntax parsing
- Natural language schedule parsing (English & Chinese)
- Task persistence and monitoring
- CRUD operations for job management
§Quick Start
ⓘ
use a3s_cron::{CronManager, CronJob, JobStatus, parse_natural};
// Create a manager with file-based storage
let manager = CronManager::new("/path/to/workspace").await?;
// Add a job using natural language
let schedule = parse_natural("every day at 2am")?; // Returns "0 2 * * *"
let job = manager.add_job("backup", &schedule, "backup.sh").await?;
// Or use Chinese
let schedule = parse_natural("每天凌晨2点")?; // Returns "0 2 * * *"
// List all jobs
let jobs = manager.list_jobs().await?;
// Start the scheduler
manager.start().await?;Re-exports§
pub use natural::parse_natural;
Modules§
- natural
- Natural language parser for cron expressions
- telemetry
- OpenTelemetry telemetry for the A3S Cron scheduler.
Structs§
- Agent
JobConfig - Agent configuration for agent-mode cron jobs
- Cron
Expression - A parsed cron expression
- CronJob
- A cron job definition
- Cron
Manager - Cron manager for job scheduling and execution
- File
Cron Store - File-based cron store
- JobExecution
- A job execution record
- Memory
Cron Store - In-memory cron store for testing
Enums§
- Cron
Error - Cron library errors
- Execution
Status - Execution result status
- JobStatus
- Job status
- JobType
- Job type — determines how the command is executed
- Scheduler
Event - Scheduler events for monitoring
Traits§
- Agent
Executor - Trait for executing agent-mode cron jobs.
- Cron
Store - Cron storage trait
Type Aliases§
- Result
- Result type alias for cron operations