@rongcloud/plugin-wechat-rtc
Version:
@rongcloud/plugin-wechat-rtc
58 lines • 1.63 kB
TypeScript
import { ILogger } from '@rongcloud/engine';
import { BaseCommand, ICommandResult } from './command/BaseCommand';
import { RCRTCCode } from './enums/RCRTCCode';
import Store from './store';
import { CommandExecuteContext } from './command/CommandExecuteContext';
import { IReadableStore } from './IReadableStore';
export type QueueItem<T, S, R> = {
command: BaseCommand<R, T, S>;
resolve: (value: ICommandResult<R> | PromiseLike<ICommandResult<R>>) => void;
};
/**
* @typeParams T - 事务执行上下文类型
* @typeParams S - 内存读写模块类型
*/
export declare class BaseInvoker<T, S> {
protected readonly _logger: ILogger;
/**
* 内存数据管理实例
*/
protected readonly _context: T;
/**
* 内存读写模块
*/
protected readonly _store: S;
/**
* 命令终止时返回的错误码定义
*/
private abortCode;
constructor(_logger: ILogger,
/**
* 内存数据管理实例
*/
_context: T,
/**
* 内存读写模块
*/
_store: S,
/**
* 命令终止时返回的错误码定义
*/
abortCode: RCRTCCode);
private _queue;
private _busy;
private _next;
private _execute;
push<R>(command: BaseCommand<R, T, S>): Promise<ICommandResult<R>>;
private _isDestroyed;
isDestroyed(): boolean;
destroy(): void;
}
/**
* 房间任务队列管理
*/
export declare class Invoker extends BaseInvoker<CommandExecuteContext, Store> {
constructor(context: CommandExecuteContext, store: Store);
get store(): IReadableStore;
}
//# sourceMappingURL=invoker.d.ts.map