import { IEntityRef } from 'commons-schema-api'; import { IWorker } from '../libs/worker/IWorker'; import { IWorkerStatisitic } from '../libs/worker/IWorkerStatisitic'; import { IQueueWorkload } from '../libs/queue/IQueueWorkload'; import { IQueueProcessor } from '../libs/queue/IQueueProcessor'; import { AsyncWorkerQueue } from '../libs/queue/AsyncWorkerQueue'; import { DistributedFindRequest } from '../libs/distributed_storage/find/DistributedFindRequest'; import { DistributedSaveRequest } from '../libs/distributed_storage/save/DistributedSaveRequest'; import { IDistributedQueryWorkerOptions } from '../libs/distributed_storage/IDistributedQueryWorkerOptions'; import { ILoggerApi } from '../libs/logging/ILoggerApi'; import { DistributedFindResponse } from '../libs/distributed_storage/find/DistributedFindResponse'; import { DistributedSaveResponse } from '../libs/distributed_storage/save/DistributedSaveResponse'; import { DS_OPERATION } from '../libs/distributed_storage/Constants'; import { DistributedUpdateResponse } from '../libs/distributed_storage/update/DistributedUpdateResponse'; import { DistributedRemoveResponse } from '../libs/distributed_storage/remove/DistributedRemoveResponse'; import { DistributedAggregateResponse } from '../libs/distributed_storage/aggregate/DistributedAggregateResponse'; import { DistributedAggregateRequest } from '../libs/distributed_storage/aggregate/DistributedAggregateRequest'; import { DistributedUpdateRequest } from '../libs/distributed_storage/update/DistributedUpdateRequest'; import { DistributedRemoveRequest } from '../libs/distributed_storage/remove/DistributedRemoveRequest'; import { AbstractEvent } from '../libs/messaging/AbstractEvent'; export interface IQueryWorkload extends IQueueWorkload { /** * Which operation should be done */ operation: DS_OPERATION; /** * Single resolve reference to entity type */ entityRef?: IEntityRef; /** * Multipe references to entity type */ entityRefs?: { [k: string]: IEntityRef; }; /** * Received event */ event: DistributedFindRequest | DistributedSaveRequest | DistributedAggregateRequest | DistributedUpdateRequest | DistributedRemoveRequest; response: DistributedFindResponse | DistributedSaveResponse | DistributedUpdateResponse | DistributedAggregateResponse | DistributedRemoveResponse; } export declare class DistributedQueryWorker implements IQueueProcessor, IWorker { private system; private entityControllerRegistry; name: string; nodeId: string; queue: AsyncWorkerQueue; logger: ILoggerApi; private options; prepare(options?: IDistributedQueryWorkerOptions): Promise; isAllowed(sourceId: string, type?: string): boolean; onRequest(event: DistributedFindRequest | DistributedSaveRequest | DistributedAggregateRequest | DistributedUpdateRequest | DistributedRemoveRequest): void; handleError(response: any): void; do(workLoad: IQueryWorkload, queue?: AsyncWorkerQueue): Promise; onFindRequest(event: DistributedFindRequest, response: DistributedFindResponse): void; onSaveRequest(event: DistributedSaveRequest, response: DistributedSaveResponse): void; onAggregateRequest(event: DistributedAggregateRequest, response: DistributedAggregateResponse): void; onRemoveRequest(event: DistributedRemoveRequest, response: DistributedRemoveResponse): void; doRemove(response: DistributedRemoveResponse, o: DistributedRemoveRequest): Promise; onUpdateRequest(event: DistributedUpdateRequest, response: DistributedUpdateResponse): void; doUpdate(response: DistributedUpdateResponse, o: DistributedUpdateRequest): Promise; doFind(response: DistributedFindResponse, o: DistributedFindRequest): Promise; doSave(response: DistributedSaveResponse, o: DistributedSaveRequest): Promise; doAggregate(response: DistributedAggregateResponse, o: DistributedAggregateRequest): Promise; createResponse(type: DS_OPERATION, req: AbstractEvent): DistributedFindResponse | DistributedSaveResponse | DistributedUpdateResponse | DistributedRemoveResponse | DistributedAggregateResponse; statistic(): IWorkerStatisitic; finish(): Promise; }