@dolittle/sdk.projections
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
62 lines • 4.56 kB
TypeScript
import { Logger } from 'winston';
import { Guid } from '@dolittle/rudiments';
import { ScopeId } from '@dolittle/sdk.events';
import { ExecutionContext } from '@dolittle/sdk.execution';
import { Cancellation } from '@dolittle/sdk.resilience';
import { Constructor } from '@dolittle/types';
import { ProjectionsClient } from '@dolittle/contracts/Runtime/Projections/Store_grpc_pb';
import { Key } from '../Key';
import { ProjectionId } from '../ProjectionId';
import { CurrentState } from './CurrentState';
import { IProjectionReadModelTypes } from './IProjectionReadModelTypes';
import { IProjectionStore } from './IProjectionStore';
import { IProjectionOf } from './IProjectionOf';
/**
* Represents an implementation of {@link IProjectionStore}.
*/
export declare class ProjectionStore extends IProjectionStore {
private readonly _projectionsClient;
private readonly _executionContext;
private readonly _readModelTypes;
private readonly _logger;
private _converter;
/**
* Initialises a new instance of the {@link ProjectionStore} class.
* @param {ProjectionsClient} _projectionsClient - The projections client to use to get projection states.
* @param {ExecutionContext} _executionContext - The execution context of the client.
* @param {IProjectionReadModelTypes} _readModelTypes - All the types associated with projections.
* @param {Logger} _logger - The logger to use for logging.
*/
constructor(_projectionsClient: ProjectionsClient, _executionContext: ExecutionContext, _readModelTypes: IProjectionReadModelTypes, _logger: Logger);
/** @inheritdoc */
of<TProjection>(type: Constructor<TProjection>): IProjectionOf<TProjection>;
of<TProjection>(type: Constructor<TProjection>, projection: ProjectionId | Guid | string): IProjectionOf<TProjection>;
of<TProjection>(type: Constructor<TProjection>, projection: ProjectionId | Guid | string, scope: ScopeId | Guid | string): IProjectionOf<TProjection>;
/** @inheritdoc */
get<TProjection>(type: Constructor<TProjection>, key: Key | any, cancellation?: Cancellation): Promise<TProjection>;
get<TProjection>(type: Constructor<TProjection>, key: Key | any, projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<TProjection>;
get<TProjection>(type: Constructor<TProjection>, key: Key | any, projection: ProjectionId | Guid | string, scope: ScopeId, cancellation?: Cancellation): Promise<TProjection>;
get(key: Key | any, projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<any>;
get(key: Key | any, projection: ProjectionId | Guid | string, scope: ScopeId | Guid | string, cancellation?: Cancellation): Promise<any>;
/** @inheritdoc */
getAll<TProjection>(type: Constructor<TProjection>, cancellation?: Cancellation): Promise<TProjection[]>;
getAll<TProjection>(type: Constructor<TProjection>, projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<TProjection[]>;
getAll<TProjection>(type: Constructor<TProjection>, projection: ProjectionId | Guid | string, scope: ScopeId | Guid | string, cancellation?: Cancellation): Promise<TProjection[]>;
getAll(projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<any[]>;
getAll(projection: ProjectionId | Guid | string, scope: ScopeId | Guid | string, cancellation?: Cancellation): Promise<any[]>;
/** @inheritdoc */
getState<TProjection>(type: Constructor<TProjection>, key: Key | any, cancellation?: Cancellation): Promise<CurrentState<TProjection>>;
getState<TProjection>(type: Constructor<TProjection>, key: Key | any, projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<CurrentState<TProjection>>;
getState<TProjection>(type: Constructor<TProjection>, key: Key | any, projection: ProjectionId | Guid | string, scope: ScopeId, cancellation?: Cancellation): Promise<CurrentState<TProjection>>;
getState(key: Key | any, projection: ProjectionId | Guid | string, cancellation?: Cancellation): Promise<CurrentState<any>>;
getState(key: Key | any, projection: ProjectionId | Guid | string, scope: ScopeId | Guid | string, cancellation?: Cancellation): Promise<CurrentState<any>>;
private getStateInternal;
private getKeyFrom;
private getProjectionAndScopeForOne;
private getProjectionAndScopeForAll;
private getCancellationFrom;
private throwIfHasFailure;
private throwIfNoState;
private throwIfWrongKeyReceived;
}
//# sourceMappingURL=ProjectionStore.d.ts.map