/** * Core types for NoSQL storage engine * Optimized for sub-10ms latency at the edge */ export interface StorageResult { success: boolean; data?: T; error?: StorageError; latency?: number; shard?: string; } export interface StorageError { code: string; message: string; cause?: Error; retryable?: boolean; shard?: string; } export interface StorageConfig { maxRetries: number; retryDelayMs: number; timeoutMs: number; connectionPool: ConnectionPoolConfig; compression: CompressionConfig; monitoring: MonitoringConfig; } export interface ConnectionPoolConfig { maxConnections: number; minConnections: number; acquireTimeoutMs: number; idleTimeoutMs: number; } export interface CompressionConfig { enabled: boolean; algorithm: 'gzip' | 'brotli' | 'zstd'; threshold: number; } export interface MonitoringConfig { enabled: boolean; metricsInterval: number; slowQueryThreshold: number; } export interface Document { _id: string; _collection: string; _version: number; _created_at: string; _updated_at: string; _deleted: boolean; [key: string]: any; } export interface DocumentQuery { filter?: Record; sort?: Record; limit?: number; skip?: number; projection?: Record; } export interface VectorData { id: string; vector: Float32Array; metadata?: Record; dimensions: number; } export interface VectorQuery { vector: Float32Array; limit?: number; threshold?: number; filter?: Record; metric?: 'cosine' | 'euclidean' | 'dot_product'; } export interface VectorSearchResult { id: string; score: number; metadata?: Record; } export interface TimeSeriesPoint { metric: string; timestamp: number; value: number | string; tags: Record; fields?: Record; } export interface TimeSeriesQuery { metric: string; timeRange: { start: string | number; end: string | number; }; tags?: Record; aggregation?: TimeSeriesAggregation; downsample?: string; } export interface TimeSeriesAggregation { window: string; functions: Array<'avg' | 'max' | 'min' | 'sum' | 'count' | 'percentile'>; percentile?: number; } export declare enum StorageBackend { D1 = "d1", KV = "kv", R2 = "r2", DURABLE_OBJECT = "durable_object" } export interface StorageOperation { id: string; type: 'read' | 'write' | 'delete'; backend: StorageBackend; shard?: string; priority: 'high' | 'medium' | 'low'; retryCount: number; maxRetries: number; timestamp: number; } export interface IndexedField { collection: string; fieldPath: string; indexColumn: string; dataType: 'text' | 'integer' | 'real' | 'blob'; cardinality?: number; selectivity?: number; } export interface SchemaEvolution { collection: string; field: string; action: 'add_index' | 'remove_index' | 'promote_field' | 'demote_field'; reason: string; timestamp: number; } export interface ShardInfo { id: string; backend: StorageBackend; region: string; size: number; status: 'active' | 'readonly' | 'offline'; keyRange?: { start: string; end: string; }; timeRange?: { start: number; end: number; }; } export interface ShardingStrategy { type: 'hash' | 'range' | 'time' | 'geographic' | 'tenant'; shardCount: number; replicationFactor: number; autoSplit: boolean; splitThreshold: number; } export interface PerformanceMetrics { operationCount: number; averageLatency: number; p95Latency: number; p99Latency: number; errorRate: number; throughput: number; cacheHitRate?: number; } export interface CacheConfig { enabled: boolean; maxSize: number; ttl: number; evictionPolicy: 'lru' | 'lfu' | 'ttl'; } export interface TransactionContext { id: string; readTimestamp: number; writeTimestamp: number; operations: StorageOperation[]; isolation: 'read_uncommitted' | 'read_committed' | 'repeatable_read' | 'serializable'; } export interface BatchOperation { operations: StorageOperation[]; transactional: boolean; maxBatchSize: number; timeout: number; } export interface StreamConfig { bufferSize: number; batchInterval: number; compression: boolean; backpressureStrategy: 'buffer' | 'drop' | 'block'; } export interface ChangeEvent { id: string; type: 'insert' | 'update' | 'delete'; collection: string; document?: Document; previous?: Document; timestamp: number; } export interface AdapterConfig { backend: StorageBackend; connectionString?: string; credentials?: Record; timeout: number; retries: number; poolSize: number; monitoring: boolean; } //# sourceMappingURL=index.d.ts.map