SyncType
Defined in: packages/rxdb/src/entity/sync-options.interface.ts:28
同步类型枚举 定义不同的数据同步策略,控制本地数据和远程数据之间的同步方式
支持三种同步策略:
- Full: 全量同步,同步所有数据
- Filter: 条件同步,根据过滤条件同步部分数据
- none: 不同步,可以配置为只使用本地数据或只使用远程数据
Enumeration Members
Filter
Filter: "filter";
Defined in: packages/rxdb/src/entity/sync-options.interface.ts:37
根据过滤条件同步
Full
Full: "full";
Defined in: packages/rxdb/src/entity/sync-options.interface.ts:32
全量同步
None
None: "none";
Defined in: packages/rxdb/src/entity/sync-options.interface.ts:58
不同步
QueryCache
QueryCache: "QueryCache";
Defined in: packages/rxdb/src/entity/sync-options.interface.ts:53
查询缓存同步模式:远端权威 + 本地行缓存,按查询 where 增量同步。
Remarks
读路径是「远端元数据 diff 本地投影 → 只拉 missing/stale → 从本地行仓储读结果」, 写路径是 remote-then-local。因此这条策略下的数据不进本地 changelog, 也没有版本化路径的冲突解决 —— 远端就是唯一事实源。
同步粒度是整个 where,与 limit 无关:适合用 where 收窄的有界结果集,
靠 limit 收窄会造成拉取放大(用 find 的 onSyncStats.remoteCount 观测)。
两侧适配器需具备 QueryCache 能力(本地 getMetadataByIds / upsertMany / deleteByIds,
远端 fetchMetadata / findByIds);缺失时构造仓储即抛 RxDBQueryCacheCapabilityError。