56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
|
|
import { IndexedDBService, IQueueOperation } from './IndexedDBService';
|
||
|
|
/**
|
||
|
|
* Operation Queue Manager
|
||
|
|
* Handles FIFO queue of pending sync operations
|
||
|
|
*/
|
||
|
|
export declare class OperationQueue {
|
||
|
|
private indexedDB;
|
||
|
|
constructor(indexedDB: IndexedDBService);
|
||
|
|
/**
|
||
|
|
* Add operation to the end of the queue
|
||
|
|
*/
|
||
|
|
enqueue(operation: Omit<IQueueOperation, 'id'>): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Get the first operation from the queue (without removing it)
|
||
|
|
* Returns null if queue is empty
|
||
|
|
*/
|
||
|
|
peek(): Promise<IQueueOperation | null>;
|
||
|
|
/**
|
||
|
|
* Get all operations in the queue (sorted by timestamp FIFO)
|
||
|
|
*/
|
||
|
|
getAll(): Promise<IQueueOperation[]>;
|
||
|
|
/**
|
||
|
|
* Remove a specific operation from the queue
|
||
|
|
*/
|
||
|
|
remove(operationId: string): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Remove the first operation from the queue and return it
|
||
|
|
* Returns null if queue is empty
|
||
|
|
*/
|
||
|
|
dequeue(): Promise<IQueueOperation | null>;
|
||
|
|
/**
|
||
|
|
* Clear all operations from the queue
|
||
|
|
*/
|
||
|
|
clear(): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Get the number of operations in the queue
|
||
|
|
*/
|
||
|
|
size(): Promise<number>;
|
||
|
|
/**
|
||
|
|
* Check if queue is empty
|
||
|
|
*/
|
||
|
|
isEmpty(): Promise<boolean>;
|
||
|
|
/**
|
||
|
|
* Get operations for a specific event ID
|
||
|
|
*/
|
||
|
|
getOperationsForEvent(eventId: string): Promise<IQueueOperation[]>;
|
||
|
|
/**
|
||
|
|
* Remove all operations for a specific event ID
|
||
|
|
*/
|
||
|
|
removeOperationsForEvent(eventId: string): Promise<void>;
|
||
|
|
/**
|
||
|
|
* Update retry count for an operation
|
||
|
|
*/
|
||
|
|
incrementRetryCount(operationId: string): Promise<void>;
|
||
|
|
}
|