oak-backend-base/lib/Synchronizer.d.ts

34 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { EntityDict, StorageSchema, EndpointItem, SyncConfig } from 'oak-domain/lib/types';
import { VolatileTrigger } from 'oak-domain/lib/types/Trigger';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
export default class Synchronizer<ED extends EntityDict & BaseEntityDict, Cxt extends BackendRuntimeContext<ED>> {
private config;
private schema;
private remotePullInfoMap;
private channelDict;
private contextBuilder;
private pushAccessMap;
private startChannel2;
/**开始同步这些channel上的oper。注意这时候即使某个channel上失败了也不应影响本事务提交其它的channel成功了 */
private startAllChannel;
private pushOperToChannel;
private refineOperData;
private dispatchOperToChannels;
/**
* 为了保证推送的oper序采用从database中顺序读取所有需要推送的oper来进行推送
* 每个进程都保证把当前所有的oper顺序处理掉就不会有乱序的问题大家通过database上的锁来完成同步
* @param context
*/
private trySynchronizeOpers;
private makeCreateOperTrigger;
constructor(config: SyncConfig<ED, Cxt>, schema: StorageSchema<ED>, contextBuilder: () => Cxt);
/**
* 根据sync的定义生成对应的 commit triggers
* @returns
*/
getSyncTriggers(): Array<VolatileTrigger<ED, keyof ED, Cxt>>;
getSelfEndpoint(): EndpointItem<ED, Cxt>;
tryCreateSyncProcess(): void;
}