跳到主要内容

assertWorkingTreeEntryCountIntact()

function assertWorkingTreeEntryCountIntact(executor, branchId): Promise<void>;

Defined in: packages/rxdb-plugin-working-tree/src/working-tree/status.ts:256

校验冗余列与实际条目行数一致(data-model.md §2.6)。

Parameters​

ParameterTypeDescription
executorTransactionExecutor调用方那个事务的执行器
branchIdstring要校验的分支

Returns​

Promise<void>

Throws​

WorkingTreeEntryCountMismatchError 两者对不上时(两个方向都抛)

Remarks​

只数本分支。 不带 branchId 的话,隔壁分支的未提交条目会把本分支的计数撑爆, 于是这条断言会在一个完全健康的库上开始误报——而误报的不变量断言很快就会被人关掉。

两个方向都抛:冗余列比行数小同样是第二份真相,症状是 status() 报干净、 commit() 却提交出一批单元。