Skip to main content

ReminderManager

Struct ReminderManager 

Source
pub struct ReminderManager { /* private fields */ }

Implementations§

Source§

impl ReminderManager

Source

pub fn new(store: Arc<dyn ReminderStore>) -> Self

Source

pub fn create(&self, input: CreateReminder) -> Result<Reminder, ReminderError>

Create and persist a new reminder. Returns the fully-populated record.

Source

pub fn get(&self, id: &str) -> Result<Reminder, ReminderError>

Retrieve a reminder by ID.

Source

pub fn list( &self, filter: &ReminderFilter, ) -> Result<Vec<Reminder>, ReminderError>

Return all reminders matching filter.

Source

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).

Source

pub fn snooze( &self, id: &str, until: DateTime<Utc>, ) -> Result<Reminder, ReminderError>

Snooze a reminder until until. Valid from Due, AwaitingPermission, or InProgress states.

Source

pub fn cancel(&self, id: &str) -> Result<Reminder, ReminderError>

Cancel a reminder. Idempotent if already cancelled.

Source

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.

Source

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.

Source

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_due and reset to Pending.
  • Otherwise mark Completed.

On non-autonomous reminders that have not yet been approved, this method transitions to AwaitingPermission instead of Due after schedule advancement.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.