import * as stream from 'stream'; import { LoggerFn } from '@cubejs-backend/shared'; import { QuerySchemasResult, QueryTablesResult, QueryColumnsResult } from '@cubejs-backend/base-driver'; import { QueryCache, Query, QueryBody } from './QueryCache'; import { PreAggregations, PreAggregationDescription } from './PreAggregations'; import { DriverFactory, DriverFactoryByDataSource } from './DriverFactory'; export type CacheAndQueryDriverType = 'memory' | 'cubestore' | /** removed, used for exception */ 'redis'; export declare enum DriverType { External = "external", Internal = "internal", Cache = "cache" } export declare enum MetadataOperationType { GET_SCHEMAS = "GET_SCHEMAS", GET_TABLES_FOR_SCHEMAS = "GET_TABLES_FOR_SCHEMAS", GET_COLUMNS_FOR_TABLES = "GET_COLUMNS_FOR_TABLES" } export interface QueryOrchestratorOptions { externalDriverFactory?: DriverFactory; cacheAndQueueDriver?: CacheAndQueryDriverType; queryCacheOptions?: any; preAggregationsOptions?: any; rollupOnlyMode?: boolean; continueWaitTimeout?: number; skipExternalCacheAndQueue?: boolean; } export declare class QueryOrchestrator { protected readonly redisPrefix: string; protected readonly driverFactory: DriverFactoryByDataSource; protected readonly logger: LoggerFn; protected queryCache: QueryCache; protected readonly preAggregations: PreAggregations; protected readonly rollupOnlyMode: boolean; protected readonly cacheAndQueueDriver: string; constructor(redisPrefix: string, driverFactory: DriverFactoryByDataSource, logger: LoggerFn, options?: QueryOrchestratorOptions); /** * Returns QueryCache instance. */ getQueryCache(): QueryCache; /** * Returns PreAggregations instance. */ getPreAggregations(): PreAggregations; /** * Force reconcile queue logic to be executed. */ forceReconcile(datasource?: string): Promise; /** * Determines whether the partition table is already exists or not. */ isPartitionExist(request: string, external: boolean, dataSource: string, schema: string, table: string, key: any, token: string): Promise<[boolean, string]>; /** * Returns stream object which will be used to stream results from * the data source if applicable. Throw otherwise. * * @throw Error */ streamQuery(query: QueryBody): Promise; /** * Push query to the queue, fetch and return result if query takes * less than `continueWaitTimeout` seconds, throw `ContinueWaitError` * error otherwise. * * @throw ContinueWaitError */ fetchQuery(queryBody: QueryBody): Promise; loadRefreshKeys(query: QueryBody): Promise; queryStage(queryBody: QueryBody): Promise<{ stage: string; timeElapsed: number; } | { stage: string; timeElapsed?: undefined; }>; resultFromCacheIfExists(queryBody: QueryBody): Promise<{ data: any; lastRefreshTime: Date; }>; testConnections(): Promise; cleanup(): Promise; getPreAggregationVersionEntries(preAggregations: { preAggregation: any; partitions: any[]; }[], preAggregationsSchema: string, requestId: string): Promise<{ structureVersionsByTableName: any; versionEntriesByTableName: any; }>; getPreAggregationPreview(requestId: string, preAggregation: PreAggregationDescription): Promise; expandPartitionsInPreAggregations(queryBody: Query): Promise; checkPartitionsBuildRangeCache(queryBody: QueryBody): Promise<{ preAggregation: PreAggregationDescription; isCached: boolean; }[]>; getPreAggregationQueueStates(dataSource?: string): Promise; cancelPreAggregationQueriesFromQueue(queryKeys: string[], dataSource?: string): Promise; cancelQueryByRequestId(requestId: string): Promise; updateRefreshEndReached(): Promise<{ key: string; bytes: number; }>; private createMetadataQuery; private queryDataSourceMetadata; /** * Query the data source for available schemas. */ queryDataSourceSchemas(dataSource?: string, options?: { requestId?: string; syncJobId?: string; expiration?: number; }): Promise; /** * Query the data source for tables within the specified schemas. */ queryTablesForSchemas(schemas: QuerySchemasResult[], dataSource?: string, options?: { requestId?: string; syncJobId?: string; expiration?: number; }): Promise; /** * Query the data source for columns within the specified tables. */ queryColumnsForTables(tables: QueryTablesResult[], dataSource?: string, options?: { requestId?: string; syncJobId?: string; expiration?: number; }): Promise; } //# sourceMappingURL=QueryOrchestrator.d.ts.map