pub struct ReminderManager { /* private fields */ }Implementations§
Source§impl ReminderManager
impl ReminderManager
pub fn new(store: Arc<dyn ReminderStore>) -> Self
Sourcepub fn create(&self, input: CreateReminder) -> Result<Reminder, ReminderError>
pub fn create(&self, input: CreateReminder) -> Result<Reminder, ReminderError>
Create and persist a new reminder. Returns the fully-populated record.
Sourcepub fn list(
&self,
filter: &ReminderFilter,
) -> Result<Vec<Reminder>, ReminderError>
pub fn list( &self, filter: &ReminderFilter, ) -> Result<Vec<Reminder>, ReminderError>
Return all reminders matching filter.
Sourcepub fn remind_me(&self) -> Result<Vec<Reminder>, ReminderError>
pub fn remind_me(&self) -> Result<Vec<Reminder>, ReminderError>
Return all reminders that are currently actionable: status Due or
AwaitingPermission, ordered by priority then due_at.
Also promotes Pending reminders whose due_at <= now to Due
(lazy promotion — avoids the need for a background timer).
Sourcepub fn snooze(
&self,
id: &str,
until: DateTime<Utc>,
) -> Result<Reminder, ReminderError>
pub fn snooze( &self, id: &str, until: DateTime<Utc>, ) -> Result<Reminder, ReminderError>
Snooze a reminder until until. Valid from Due, AwaitingPermission,
or InProgress states.
Sourcepub fn cancel(&self, id: &str) -> Result<Reminder, ReminderError>
pub fn cancel(&self, id: &str) -> Result<Reminder, ReminderError>
Cancel a reminder. Idempotent if already cancelled.
Sourcepub fn approve(
&self,
id: &str,
approved_by: &str,
) -> Result<Reminder, ReminderError>
pub fn approve( &self, id: &str, approved_by: &str, ) -> Result<Reminder, ReminderError>
Approve a non-autonomous reminder for execution, recording who approved.
Transitions AwaitingPermission → Due.
Sourcepub fn start(&self, id: &str, agent_id: &str) -> Result<Reminder, ReminderError>
pub fn start(&self, id: &str, agent_id: &str) -> Result<Reminder, ReminderError>
Mark a reminder as in-progress. Transitions Due → InProgress.
Non-autonomous reminders must be approved first.
Sourcepub fn record_execution(
&self,
id: &str,
record: ExecutionRecord,
) -> Result<Reminder, ReminderError>
pub fn record_execution( &self, id: &str, record: ExecutionRecord, ) -> Result<Reminder, ReminderError>
Complete an execution attempt, appending the ExecutionRecord.
On Success:
- If the reminder has a repeating schedule, compute
next_dueand reset toPending. - Otherwise mark
Completed.
On non-autonomous reminders that have not yet been approved, this
method transitions to AwaitingPermission instead of Due after
schedule advancement.
Sourcepub fn mark_ref_stale(
&self,
id: &str,
ref_id: &str,
) -> Result<usize, ReminderError>
pub fn mark_ref_stale( &self, id: &str, ref_id: &str, ) -> Result<usize, ReminderError>
Mark a ref as stale by ref_id. Returns the number of refs updated.