import type { IMessageStore } from './IMessageStore.ts'; /** * A buffer that stores items of type `T` up to a specified maximum size. * Implements the IMessageStore interface for generic types. */ export declare class MessageBuffer implements IMessageStore { /** * A number representing the next expected message sequence number. * @private */ private nextMsgSeqNum; /** * An array holding the items in the buffer. * @private */ private buffer; /** * The maximum capacity of the buffer. * @private */ private maxBufferSize; constructor(maxBufferSize?: number); /** * Adds a new item to the buffer. * If the buffer is full, the oldest item is removed to make space for the new one. * * @param {T} item - The item to add to the buffer. * @returns {void} */ add(item: T): void; /** * Retrieves an item from the buffer by its sequence number (or any other identifier). * * @param {number} msgSequence - The sequence number of the item to retrieve. * @returns {T | undefined} The item if found, or `undefined` if not found. */ getByMsgSequence(msgSequence: number): T | undefined; /** * Removes an item from the buffer by its sequence number. * * @param {number} msgSequence - The sequence number of the item to remove. * @returns {void} */ remove(msgSequence: number): void; /** * Updates an item in the buffer. * * @param {number} msgSequence - The sequence number of the item to update. * @param {T} item - The updated item. * @returns {boolean} - Returns `true` if the item was updated successfully, `false` otherwise. */ update(msgSequence: number, item: T): boolean; /** * Retrieves all items from the buffer. * * @returns {T[]} - An array of all items in the buffer. */ getAll(): T[]; /** * Checks if an item with a given sequence number exists in the buffer. * * @param {number} msgSequence - The sequence number of the item to check. * @returns {boolean} - `true` if the item exists, `false` otherwise. */ exists(msgSequence: number): boolean; /** * Gets the current size of the buffer (the number of items it contains). * * @returns {number} The number of items currently in the buffer. */ size(): number; /** * Resizes the buffer's capacity. * * @param {number} newCapacity - The new maximum capacity for the buffer. * @returns {void} */ resize(newCapacity: number): void; /** * Clears all items from the buffer. * * @returns {void} */ clear(): void; /** * Gets the maximum capacity of the buffer. * * @returns {number} The maximum number of items the buffer can hold. */ getCapacity(): number; /** * Set the next message sequence number. * * @param nextMsgSeqNum - The next message sequence number. * @returns {number} - The next message sequence number. */ setNextMsgSeqNum(nextMsgSeqNum: number): number; /** * Get the next message sequence number. * * @returns {number} - The next message sequence number. */ getNextMsgSeqNum(): number; }