chore: recovery checkpoint - v3.0 API successfully recovered
CRITICAL CHECKPOINT - DO NOT PUSH TO GITHUB Recovery Status: - Successfully recovered brainy.ts from compiled JavaScript - All core v3.0 API methods functional (add, get, update, delete, relate, find, etc.) - Neural subsystem intact (562KB embedded patterns, NLP working) - Augmentation pipeline operational (20+ augmentations) - HNSW clustering system complete - Triple Intelligence compiled (needs constructor fix) - Test suite validates functionality Changes preserved: - 898 files with changes from last 3 days - 144,475 insertions - All augmentation improvements - All test coverage enhancements - Complete v3.0 feature set This is a LOCAL checkpoint only - contains recovered work after corruption incident. Created backup in .backups/brainy-full-20250910-151314.tar.gz Branch: recovery-checkpoint-20250910-151433 Date: Wed Sep 10 03:18:04 PM PDT 2025
This commit is contained in:
parent
f65455fb22
commit
8ff382ca3b
895 changed files with 143654 additions and 28268 deletions
91
.recovery-workspace/dist-backup-20250910-141917/utils/requestCoalescer.d.ts
vendored
Normal file
91
.recovery-workspace/dist-backup-20250910-141917/utils/requestCoalescer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/**
|
||||
* Request Coalescer
|
||||
* Batches and deduplicates operations to reduce S3 API calls
|
||||
* Automatically flushes based on size, time, or pressure
|
||||
*/
|
||||
interface CoalescedOperation {
|
||||
type: 'write' | 'read' | 'delete';
|
||||
key: string;
|
||||
data?: any;
|
||||
resolve: (value: any) => void;
|
||||
reject: (error: any) => void;
|
||||
timestamp: number;
|
||||
}
|
||||
interface BatchStats {
|
||||
totalOperations: number;
|
||||
coalescedOperations: number;
|
||||
deduplicated: number;
|
||||
batchesProcessed: number;
|
||||
averageBatchSize: number;
|
||||
}
|
||||
/**
|
||||
* Coalesces multiple operations into efficient batches
|
||||
*/
|
||||
export declare class RequestCoalescer {
|
||||
private logger;
|
||||
private writeQueue;
|
||||
private readQueue;
|
||||
private deleteQueue;
|
||||
private maxBatchSize;
|
||||
private maxBatchAge;
|
||||
private minBatchSize;
|
||||
private flushTimer;
|
||||
private lastFlush;
|
||||
private stats;
|
||||
private processor;
|
||||
constructor(processor: (batch: CoalescedOperation[]) => Promise<void>, options?: {
|
||||
maxBatchSize?: number;
|
||||
maxBatchAge?: number;
|
||||
minBatchSize?: number;
|
||||
});
|
||||
/**
|
||||
* Add a write operation to be coalesced
|
||||
*/
|
||||
write(key: string, data: any): Promise<void>;
|
||||
/**
|
||||
* Add a read operation to be coalesced
|
||||
*/
|
||||
read(key: string): Promise<any>;
|
||||
/**
|
||||
* Add a delete operation to be coalesced
|
||||
*/
|
||||
delete(key: string): Promise<void>;
|
||||
/**
|
||||
* Check if we should flush the queues
|
||||
*/
|
||||
private checkFlush;
|
||||
/**
|
||||
* Flush all queued operations
|
||||
*/
|
||||
flush(reason?: string): Promise<void>;
|
||||
/**
|
||||
* Get current statistics
|
||||
*/
|
||||
getStats(): BatchStats;
|
||||
/**
|
||||
* Get current queue sizes
|
||||
*/
|
||||
getQueueSizes(): {
|
||||
writes: number;
|
||||
reads: number;
|
||||
deletes: number;
|
||||
total: number;
|
||||
};
|
||||
/**
|
||||
* Adjust batch parameters based on load
|
||||
*/
|
||||
adjustParameters(pending: number): void;
|
||||
/**
|
||||
* Force immediate flush of all operations
|
||||
*/
|
||||
forceFlush(): Promise<void>;
|
||||
}
|
||||
/**
|
||||
* Get or create a coalescer for a storage instance
|
||||
*/
|
||||
export declare function getCoalescer(storageId: string, processor: (batch: any[]) => Promise<void>): RequestCoalescer;
|
||||
/**
|
||||
* Clear all coalescers
|
||||
*/
|
||||
export declare function clearCoalescers(): void;
|
||||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue