pub struct CheckpointBatcher { /* private fields */ }Expand description
The checkpoint batcher collects checkpoint requests and sends them in batches.
This improves efficiency by reducing the number of API calls to the Lambda service. The batcher sends a batch when any of these conditions are met:
- The batch reaches the maximum size in bytes
- The batch reaches the maximum number of operations
- The maximum batch time has elapsed
Implementations§
Source§impl CheckpointBatcher
impl CheckpointBatcher
Sourcepub fn new(
config: CheckpointBatcherConfig,
queue_rx: Receiver<CheckpointRequest>,
service_client: SharedDurableServiceClient,
durable_execution_arn: String,
checkpoint_token: Arc<RwLock<String>>,
) -> Self
pub fn new( config: CheckpointBatcherConfig, queue_rx: Receiver<CheckpointRequest>, service_client: SharedDurableServiceClient, durable_execution_arn: String, checkpoint_token: Arc<RwLock<String>>, ) -> Self
Creates a new CheckpointBatcher.
§Arguments
config- Configuration for batching behaviorqueue_rx- Receiver for checkpoint requestsservice_client- Service client for sending checkpointsdurable_execution_arn- The ARN of the durable executioncheckpoint_token- The initial checkpoint token from Lambda invocation input
§Requirements
- 2.9: THE Checkpointing_System SHALL use the CheckpointToken from invocation input for the first checkpoint
Sourcepub async fn run(&mut self)
pub async fn run(&mut self)
Runs the batcher loop, processing checkpoint requests.
This method runs until the queue is closed (sender dropped).
Sourcepub fn sort_checkpoint_batch(
batch: Vec<CheckpointRequest>,
) -> Vec<CheckpointRequest>
pub fn sort_checkpoint_batch( batch: Vec<CheckpointRequest>, ) -> Vec<CheckpointRequest>
Sorts checkpoint requests according to the ordering rules.
The ordering rules are:
- Operations are checkpointed in execution order (preserving original order)
- EXECUTION completion (SUCCEED/FAIL on EXECUTION type) must be last in the batch
- Child operations must come after their parent CONTEXT starts
- START and completion (SUCCEED/FAIL) for the same operation can be in the same batch
§Requirements
- 2.12: WHEN batching operations, THE Checkpointing_System SHALL checkpoint in execution order with EXECUTION completion last
- 2.13: THE Checkpointing_System SHALL support including both START and completion actions for STEP/CONTEXT in the same batch
Auto Trait Implementations§
impl !Freeze for CheckpointBatcher
impl !RefUnwindSafe for CheckpointBatcher
impl Send for CheckpointBatcher
impl Sync for CheckpointBatcher
impl Unpin for CheckpointBatcher
impl UnsafeUnpin for CheckpointBatcher
impl !UnwindSafe for CheckpointBatcher
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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.