core/tree/snapshot_budget library
Snapshot budget — cap what one push carries, ranked by what the planner can actually USE.
Constants
- kSnapshotMaxNodes → const int
- Default node budget per pushed snapshot (RN parity).
- kSnapshotSendCapBytes → const int
- Serialized UTF-8 payload cap for reliable data packets. LiveKit recommends at most 15 KiB of user data; 15000 leaves a little additional headroom. https://docs.livekit.io/transport/data/packets/#size-limits
Functions
-
applySnapshotBudget(
UiSnapshot snap, {int maxNodes = kSnapshotMaxNodes}) → UiSnapshot -
Trim
snapto at mostmaxNodesnodes by rank, keeping document order. -
applySnapshotByteBudget(
UiSnapshot snap, {int maxBytes = kSnapshotSendCapBytes}) → UiSnapshot? -
Keep the highest-ranked nodes whose full baseline fits
maxBytes. -
snapshotBudgetRank(
UiNode n) → int - Planner-usefulness rank; LOWER survives the budget.