/** * @nahisaho/yata-scale - Distributed Executor * * Executes queries across multiple shards */ import { type Result } from 'neverthrow'; import type { GraphQuery, QueryResult, QueryPlan, Entity, Relationship } from '../types.js'; import { QueryExecutionError } from '../errors.js'; import { WorkerPool } from './WorkerPool.js'; /** * Shard query function */ export type ShardQueryFn = (shardId: string, query: GraphQuery) => Promise<{ entities: Entity[]; relationships: Relationship[]; }>; /** * Execution context */ export interface ExecutionContext { readonly queryId: string; readonly startTime: Date; readonly timeoutMs: number; readonly shards: string[]; } /** * Distributed query executor */ export declare class DistributedExecutor { private readonly workerPool; private readonly defaultTimeoutMs; constructor(parallelism?: number, defaultTimeoutMs?: number); /** * Execute query across shards */ execute(plan: QueryPlan, shards: string[], queryFn: ShardQueryFn): Promise>; /** * Execute query in parallel across shards */ private executeParallel; /** * Execute query sequentially across shards */ private executeSequential; /** * Execute promise with timeout */ private executeWithTimeout; /** * Merge results from multiple shards */ private mergeResults; /** * Deduplicate entities by ID */ private deduplicateEntities; /** * Deduplicate relationships by ID */ private deduplicateRelationships; /** * Apply sort order */ private applySort; /** * Apply limit */ private applyLimit; /** * Get worker pool */ getWorkerPool(): WorkerPool; /** * Shutdown executor */ shutdown(): Promise; } //# sourceMappingURL=DistributedExecutor.d.ts.map