pub struct DynamoDbCheckpointer { /* private fields */ }
Expand description
DynamoDB-backed checkpointer for serverless AWS deployments.
§Examples
use agents_aws::DynamoDbCheckpointer;
use std::time::Duration;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Using default AWS configuration
let checkpointer = DynamoDbCheckpointer::new("agent-checkpoints").await?;
// With custom configuration and TTL
let checkpointer = DynamoDbCheckpointer::builder()
.table_name("my-agents")
.ttl(Duration::from_secs(86400 * 7)) // 7 days
.build()
.await?;
Ok(())
}
Implementations§
Source§impl DynamoDbCheckpointer
impl DynamoDbCheckpointer
Sourcepub async fn new(
table_name: impl Into<String>,
) -> Result<DynamoDbCheckpointer, Error>
pub async fn new( table_name: impl Into<String>, ) -> Result<DynamoDbCheckpointer, Error>
Create a new DynamoDB checkpointer with default AWS configuration.
This will use the default AWS credential chain (environment variables, IAM roles, AWS config files, etc.).
§Arguments
table_name
- The name of the DynamoDB table
Sourcepub fn builder() -> DynamoDbCheckpointerBuilder
pub fn builder() -> DynamoDbCheckpointerBuilder
Create a builder for configuring the DynamoDB checkpointer.
Trait Implementations§
Source§impl Checkpointer for DynamoDbCheckpointer
impl Checkpointer for DynamoDbCheckpointer
Source§fn save_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 String,
state: &'life2 AgentStateSnapshot,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
DynamoDbCheckpointer: 'async_trait,
fn save_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 String,
state: &'life2 AgentStateSnapshot,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
DynamoDbCheckpointer: 'async_trait,
Save the current agent state for a given thread.
Source§fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 String,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentStateSnapshot>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
DynamoDbCheckpointer: 'async_trait,
fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 String,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentStateSnapshot>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
DynamoDbCheckpointer: 'async_trait,
Load the last saved state for a given thread.
Returns None if no state exists for this thread.
Source§impl Clone for DynamoDbCheckpointer
impl Clone for DynamoDbCheckpointer
Source§fn clone(&self) -> DynamoDbCheckpointer
fn clone(&self) -> DynamoDbCheckpointer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DynamoDbCheckpointer
impl !RefUnwindSafe for DynamoDbCheckpointer
impl Send for DynamoDbCheckpointer
impl Sync for DynamoDbCheckpointer
impl Unpin for DynamoDbCheckpointer
impl !UnwindSafe for DynamoDbCheckpointer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.