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
83 lines
2.2 KiB
TypeScript
83 lines
2.2 KiB
TypeScript
/**
|
|
* Enhanced Clear/Delete Operations for Brainy Storage
|
|
* Provides safe, efficient, and production-ready bulk deletion methods
|
|
*/
|
|
export interface ClearOptions {
|
|
/**
|
|
* Safety confirmation - must match database instance name
|
|
* Prevents accidental deletion of wrong databases
|
|
*/
|
|
confirmInstanceName?: string;
|
|
/**
|
|
* Performance optimization settings
|
|
*/
|
|
batchSize?: number;
|
|
maxConcurrency?: number;
|
|
/**
|
|
* Safety mechanisms
|
|
*/
|
|
dryRun?: boolean;
|
|
createBackup?: boolean;
|
|
/**
|
|
* Progress callback for large operations
|
|
*/
|
|
onProgress?: (progress: ClearProgress) => void;
|
|
}
|
|
export interface ClearProgress {
|
|
stage: 'backup' | 'nouns' | 'verbs' | 'metadata' | 'system' | 'cache' | 'complete';
|
|
totalItems: number;
|
|
processedItems: number;
|
|
errors: number;
|
|
estimatedTimeRemaining?: number;
|
|
}
|
|
export interface ClearResult {
|
|
success: boolean;
|
|
itemsDeleted: {
|
|
nouns: number;
|
|
verbs: number;
|
|
metadata: number;
|
|
system: number;
|
|
};
|
|
duration: number;
|
|
errors: Error[];
|
|
backupLocation?: string;
|
|
}
|
|
/**
|
|
* Enhanced FileSystem bulk delete operations
|
|
*/
|
|
export declare class EnhancedFileSystemClear {
|
|
private rootDir;
|
|
private fs;
|
|
private path;
|
|
constructor(rootDir: string, fs: any, path: any);
|
|
/**
|
|
* Optimized bulk delete for filesystem storage
|
|
* Uses parallel deletion with controlled concurrency
|
|
*/
|
|
clear(options?: ClearOptions): Promise<ClearResult>;
|
|
/**
|
|
* High-performance directory clearing with controlled concurrency
|
|
*/
|
|
private clearDirectoryOptimized;
|
|
private createBackup;
|
|
private performDryRun;
|
|
}
|
|
/**
|
|
* Enhanced S3 bulk delete operations
|
|
*/
|
|
export declare class EnhancedS3Clear {
|
|
private s3Client;
|
|
private bucketName;
|
|
constructor(s3Client: any, bucketName: string);
|
|
/**
|
|
* Optimized bulk delete for S3 storage
|
|
* Uses batch delete operations for maximum efficiency
|
|
*/
|
|
clear(options?: ClearOptions): Promise<ClearResult>;
|
|
/**
|
|
* High-performance prefix clearing using S3 batch delete
|
|
*/
|
|
private clearPrefixOptimized;
|
|
private getBucketInfo;
|
|
private performDryRun;
|
|
}
|