跳到主要内容

ReplayRestoreResult

type ReplayRestoreResult =
| {
ok: true;
restoredCount: number;
sessionId: string | null;
workingTreeRevision: number;
}
| {
ok: false;
reason: ReplayRestoreRejection;
};

Defined in: packages/rxdb-plugin-replay/src/types.ts:17

restoreToCommit() 的结果:工作树 restore() 结果里回放用得上的那部分。

Union Members​

Type Literal​

{
ok: true;
restoredCount: number;
sessionId: string | null;
workingTreeRevision: number;
}

ok​

readonly ok: true;

restoredCount​

readonly restoredCount: number;

写进工作树的条目数;0 是一次 no-op

sessionId​

readonly sessionId: string | null;

本次建立的恢复会话 id;no-op 时为 null

workingTreeRevision​

readonly workingTreeRevision: number;

本次调用之后的工作树 revision


Type Literal​

{
ok: false;
reason: ReplayRestoreRejection;
}

Remarks​

不直接引用 @aiao/rxdb-plugin-working-tree 的 WorkingTreeRestoreResult:它是可选 peer,类型导入一旦进了 公开签名就会留在 .d.ts 里,没装它的 strict 消费方连录制都编不过。被拒时的诊断细节(conflict / incompatible) 运行时仍在对象上,要类型就直接用工作树的 restore()。