/**
 * Memory Buffer System
 * Provides fast, non-blocking memory writes with eventual consistency
 */
export declare enum MemoryBufferStatus {
    PENDING = "pending",
    WRITING = "writing",
    RETRYING = "retrying",
    COMPLETED = "completed",
    FAILED = "failed"
}
export interface MemoryBufferItem {
    id: string;
    memoryData: Record<string, any>;
    status: MemoryBufferStatus;
    timestamp: number;
    attempts: number;
    lastError?: string;
    completedAt?: number;
}
export interface BufferMetrics {
    queued: number;
    completed: number;
    failed: number;
    retries: number;
    successRate: number;
    queueDepth: number;
    retryQueueDepth: number;
    avgWriteTime: number;
    lastWriteTime: number;
    cacheSize: number;
}
export interface BufferStatus {
    pendingCount: number;
    retryCount: number;
    processingCount: number;
    completedCount: number;
    failedCount: number;
    totalInCache: number;
}
export declare class MemoryBuffer {
    private persistPath;
    private maxSize;
    private pendingQueue;
    private retryQueue;
    private itemsCache;
    private completedItems;
    private failedItems;
    private persistLock;
    private lastPersist;
    private persistInterval;
    private metrics;
    constructor(persistPath?: string, maxSize?: number);
    private ensurePersistDir;
    /**
     * Add memory to buffer for async write
     */
    add(memoryData: Record<string, any>): Promise<string>;
    /**
     * Get next item to write
     */
    getNextPending(): Promise<MemoryBufferItem | null>;
    /**
     * Get next item to retry if due
     */
    getNextRetry(): Promise<MemoryBufferItem | null>;
    /**
     * Mark item as successfully written
     */
    markCompleted(itemOrId: MemoryBufferItem | string): Promise<void>;
    /**
     * Mark item as permanently failed
     */
    markFailed(memoryId: string, error: string): Promise<void>;
    /**
     * Schedule item for retry
     */
    scheduleRetry(item: MemoryBufferItem, delay: number): Promise<void>;
    /**
     * Get overall buffer status
     */
    getStatus(): Promise<BufferStatus>;
    /**
     * Get status of a specific buffered memory
     */
    getItemStatus(memoryId: string): Promise<Record<string, any>>;
    /**
     * Get buffer metrics
     */
    getMetrics(): Promise<BufferMetrics>;
    private cleanupItem;
    private persistIfNeeded;
    /**
     * Persist buffer state to disk
     */
    persist(): Promise<void>;
    /**
     * Restore buffer from disk
     */
    restore(): Promise<number>;
    /**
     * Close buffer and persist final state
     */
    close(): Promise<void>;
    private itemToDict;
    private itemFromDict;
}
//# sourceMappingURL=buffer.d.ts.map