pub trait ScheduleStore: Send + Sync {
// Required methods
fn upsert<'life0, 'async_trait>(
&'life0 self,
schedule: Schedule,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Schedule>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn set_paused<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
paused: bool,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn due<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn advance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
expected_revision: u64,
next_fire_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<bool, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling Stores schedules and lets one replica at a time advance each.
Every backend passes adk_core::schedule_store_conformance_tests! (feature conformance).
Required Methods§
Sourcefn upsert<'life0, 'async_trait>(
&'life0 self,
schedule: Schedule,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn upsert<'life0, 'async_trait>(
&'life0 self,
schedule: Schedule,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Inserts or replaces the schedule with schedule.id and returns the stored one.
The store assigns the revision: 1 on insert, the previous revision plus one on a change. Upserting a definition identical to the stored one (spec, run, missed policy, paused flag, next fire time) changes nothing, so replicas registering the same schedule at startup do not disturb an advance in flight.
§Errors
Returns the Schedule::validate error.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Returns a schedule, or None when it does not exist.
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns every schedule, ordered by id.
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sourcefn set_paused<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
paused: bool,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn set_paused<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
paused: bool,
) -> Pin<Box<dyn Future<Output = Result<Schedule, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Pauses or resumes a schedule and returns it; the revision moves only on a change.
§Errors
Returns SCHEDULE_NOT_FOUND_CODE for an unknown schedule.
Sourcefn due<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn due<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Schedule>, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Returns up to limit unpaused schedules whose next_fire_at is at or before
now, earliest first, ties by id.
Sourcefn advance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
expected_revision: u64,
next_fire_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<bool, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn advance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
expected_revision: u64,
next_fire_at: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = Result<bool, AdkError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sets next_fire_at when the stored revision equals expected_revision, and
returns false when another replica advanced or changed the schedule first.
§Errors
Returns SCHEDULE_NOT_FOUND_CODE for an unknown schedule.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".