// Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; using System.Threading.Tasks; namespace Microsoft.Agents.AI.Workflows.Checkpointing; /// /// Defines a contract for storing and retrieving checkpoints associated with a specific session and key. /// /// The type of object to be stored as the value for each checkpoint. public interface ICheckpointStore { /// /// Asynchronously retrieves the collection of checkpoint information for the specified session identifier, optionally /// filtered by a parent checkpoint. /// /// The unique identifier of the session for which to retrieve checkpoint information. Cannot be null or empty. /// An optional parent checkpoint to filter the results. If specified, only checkpoints with the given parent are /// returned; otherwise, all checkpoints for the session are included. /// A value task representing the asynchronous operation. The result contains a collection of objects associated with the specified session. The collection is empty if no checkpoints are /// found. ValueTask> RetrieveIndexAsync(string sessionId, CheckpointInfo? withParent = null); /// /// Asynchronously creates a checkpoint for the specified session and key, associating it with the provided value and /// optional parent checkpoint. /// /// The unique identifier of the session for which the checkpoint is being created. Cannot be null or empty. /// The value to associate with the checkpoint. Cannot be null. /// The optional parent checkpoint information. If specified, the new checkpoint will be linked as a child of this /// parent. /// A ValueTask that represents the asynchronous operation. The result contains the /// object representing this stored checkpoint. ValueTask CreateCheckpointAsync(string sessionId, TStoreObject value, CheckpointInfo? parent = null); /// /// Asynchronously retrieves a checkpoint object associated with the specified session and checkpoint key. /// /// The unique identifier of the session for which the checkpoint is to be retrieved. Cannot be null or empty. /// The key identifying the specific checkpoint to retrieve. Cannot be null. /// A ValueTask that represents the asynchronous operation. The result contains the checkpoint object associated /// with the specified session and key. ValueTask RetrieveCheckpointAsync(string sessionId, CheckpointInfo key); }