resolve_current_branch()
function resolve_current_branch(branchRepository, rxdb): Promise<RxDBBranch>;
Defined in: packages/rxdb/src/system/system-repositories.ts:36
解析「当前分支」:取激活分支,没有则激活 main,main 也不存在则建一个。
Parameters
| Parameter | Type | Description |
|---|---|---|
branchRepository | LocalRxDBBranchRepository | 分支仓库 |
rxdb | RxDB | RxDB 实例,只用于 entityManager.instantiate |
Returns
Promise<RxDBBranch>
Remarks
只接收仓库、不接收管理器:谁传进来的仓库属于哪个事务,这段逻辑就跑在哪个事务里,
函数本身不做任何入队决策。getCurrentBranch 的冷路径与插件侧的 create_branch
(它自己已经开着事务,再走一次 getCurrentBranch 会经绑在适配器上的仓库重新入队,
排在自己这个事务后面,队列并发度 1,永久挂起)共用它。