import type { IMessageStore } from './IMessageStore.ts'; /** * The `IAsyncMessageStore` interface extends `IMessageStore` with asynchronous variants * for methods that may need to interact with persistent storage (databases, file systems, * remote stores). * * Implementations MUST provide synchronous methods (inherited from `IMessageStore`) for * hot-path operations (`getNextMsgSeqNum`, `setNextMsgSeqNum`, `add`) that work against * an in-memory cache. The async methods provide access to the full persistent store. * * @interface IAsyncMessageStore */ export interface IAsyncMessageStore extends IMessageStore { /** * Asynchronously retrieves an item of type `T` from the persistent store by its * sequence number. Falls back to persistent storage when the item is not in the * in-memory cache. * * @param {number} msgSequence - The sequence number of the item to retrieve. * * @returns {Promise} - The item if found, otherwise `undefined`. */ getByMsgSequenceAsync(msgSequence: number): Promise; /** * Asynchronously retrieves all items of type `T` from the persistent store. * * @returns {Promise} - An array of all items in the store. */ getAllAsync(): Promise; /** * Asynchronously checks if an item with a given sequence number exists in the * persistent store. * * @param {number} msgSequence - The sequence number of the item to check. * @returns {Promise} - `true` if the item exists, `false` otherwise. */ existsAsync?(msgSequence: number): Promise; /** * Asynchronously removes an item from the persistent store by its sequence number. * * @param {number} msgSequence - The sequence number of the item to remove. * * @returns {Promise} */ removeAsync?(msgSequence: number): Promise; /** * Asynchronously clears all items from the persistent store. * * @returns {Promise} */ clearAsync?(): Promise; /** * Flushes any pending writes from the in-memory cache to the persistent store. * * @returns {Promise} */ flushAsync?(): Promise; } /** * Type guard to check if a message store supports async operations. * * @param {IMessageStore} store - The message store to check. * @returns {boolean} - `true` if the store implements `IAsyncMessageStore`, `false` otherwise. */ export declare function isAsyncMessageStore(store: IMessageStore): store is IAsyncMessageStore;