@orbit/coordinator
Version:
A coordinator and set of coordination strategies for managing data flow and keeping @orbit/data sources in sync.
50 lines (49 loc) • 1.64 kB
TypeScript
import { Source } from '@orbit/data';
import { Coordinator, ActivationOptions, LogLevel } from './coordinator';
export interface StrategyOptions {
/**
* Name of strategy.
*
* Used to uniquely identify this strategy in a coordinator's collection.
*/
name?: string;
/**
* The names of sources to include in this strategy. Leave undefined
* to include all sources registered with a coordinator.
*/
sources?: string[];
/**
* The prefix to use for logging from this strategy.
*
* Defaults to `[${name}]`.
*/
logPrefix?: string;
/**
* A specific log level for this strategy.
*
* Overrides the log level used when activating the coordinator.
*/
logLevel?: LogLevel;
}
export declare abstract class Strategy {
protected _name: string;
protected _coordinator?: Coordinator;
protected _sourceNames?: string[];
protected _sources: Source[];
protected _customLogLevel?: LogLevel;
protected _logLevel?: LogLevel;
protected _logPrefix: string;
constructor(options?: StrategyOptions);
activate(coordinator: Coordinator, options?: ActivationOptions): Promise<void>;
deactivate(): Promise<void>;
beforeSourceActivation(): Promise<void>;
afterSourceActivation(): Promise<void>;
beforeSourceDeactivation(): Promise<void>;
afterSourceDeactivation(): Promise<void>;
get name(): string;
get coordinator(): Coordinator | undefined;
get sources(): Source[];
get logPrefix(): string;
get logLevel(): LogLevel | undefined;
protected getSourceName(source: Source): string;
}