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
58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
/**
|
|
* Utility functions for timeout and retry logic
|
|
* Used by storage adapters to handle network operations reliably
|
|
*/
|
|
export interface TimeoutConfig {
|
|
get?: number;
|
|
add?: number;
|
|
delete?: number;
|
|
}
|
|
export interface RetryConfig {
|
|
maxRetries?: number;
|
|
initialDelay?: number;
|
|
maxDelay?: number;
|
|
backoffMultiplier?: number;
|
|
}
|
|
export interface OperationConfig {
|
|
timeouts?: TimeoutConfig;
|
|
retryPolicy?: RetryConfig;
|
|
}
|
|
export declare const DEFAULT_TIMEOUTS: Required<TimeoutConfig>;
|
|
export declare const DEFAULT_RETRY_POLICY: Required<RetryConfig>;
|
|
/**
|
|
* Wraps a promise with a timeout
|
|
*/
|
|
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, operation: string): Promise<T>;
|
|
/**
|
|
* Executes an operation with retry logic and exponential backoff
|
|
*/
|
|
export declare function withRetry<T>(operation: () => Promise<T>, operationName: string, config?: RetryConfig): Promise<T>;
|
|
/**
|
|
* Executes an operation with both timeout and retry logic
|
|
*/
|
|
export declare function withTimeoutAndRetry<T>(operation: () => Promise<T>, operationName: string, timeoutMs: number, retryConfig?: RetryConfig): Promise<T>;
|
|
/**
|
|
* Creates a configured operation executor for a specific operation type
|
|
*/
|
|
export declare function createOperationExecutor(operationType: keyof TimeoutConfig, config?: OperationConfig): <T>(operation: () => Promise<T>, operationName: string) => Promise<T>;
|
|
/**
|
|
* Storage operation executors for different operation types
|
|
*/
|
|
export declare class StorageOperationExecutors {
|
|
private getExecutor;
|
|
private addExecutor;
|
|
private deleteExecutor;
|
|
constructor(config?: OperationConfig);
|
|
/**
|
|
* Execute a get operation with timeout and retry
|
|
*/
|
|
executeGet<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
/**
|
|
* Execute an add operation with timeout and retry
|
|
*/
|
|
executeAdd<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
/**
|
|
* Execute a delete operation with timeout and retry
|
|
*/
|
|
executeDelete<T>(operation: () => Promise<T>, operationName: string): Promise<T>;
|
|
}
|