Initial commit: Brainy - Multi-Dimensional AI Database
Open source vector database with HNSW indexing, graph relationships, and metadata facets. Features CLI with professional augmentation registry integration for discovering extensions and capabilities.
This commit is contained in:
commit
f8c45f2d8d
448 changed files with 103294 additions and 0 deletions
58
dist/utils/operationUtils.d.ts
vendored
Normal file
58
dist/utils/operationUtils.d.ts
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* 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>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue