Function rebuildLevel

  • Rebuilds a level of the tree.

    Parameters

    • cursor: Cursor

      The cursor to the current tree.

    • updts: Updts

      The state of the updates for the tree.

    • state: State

      The state of the mutation.

    • level: number

      The level to be rebuilt.

    • createIsBoundary: CreateIsBoundary

      Function to determine if an entry is a boundary.

    Returns AsyncIterable<ProllyTreeDiff>

    Only yields diffs when the level is changed. Entry diffs are only yielded on level 0. Writes to the state.removedBuckets array if a level 0 bucket is changed/removed/added. Writes to the state.newRoot if a new root is found. A new root is found when the tail and head buckets were visited and only one bucket was rebuilt for the level.