findCurrentSyncRecord()
function findCurrentSyncRecord(
rxdb,
namespace,
entity
): Promise<RxDBSync | undefined>;
Defined in: packages/rxdb/src/sync-contract/sync-record-utils.ts:48
Internal
读取某个 repository 在当前分支上的同步记录(只读,不创建)
Parameters
| Parameter | Type | Description |
|---|---|---|
rxdb | RxDB | RxDB 实例 |
namespace | string | 命名空间 |
entity | string | 实体名 |
Returns
Promise<RxDBSync | undefined>
同步记录;从未同步过(记录尚未懒创建)时返回 undefined
Remarks
资格判定(pullIneligibility / pushIneligibility)需要 enabled,
但它必须发生在碰远端之前,而 getOrCreateSyncRecord 的调用点在拉/推流程内部、
已经晚了。这里刻意只读不创建:判定阶段就写一条系统记录,会让「问一句能不能同步」
变成一次写事务。