type

PopulationBudget

A shared recursive population materialization budget.

How it works

NewPopulationBudget creates a concurrency-safe budget. ConsumeDocument counts nested populated documents and returns ErrPopulationLimit above the bound. Official adapters initialize the default MaxPopulationMaterializedDocuments (4096) when omitted.

Full signature

type PopulationBudget struct { // contains filtered or unexported fields }

Source store/population.go:14

Methods

  • PopulationBudget.ConsumeDocument()

    ConsumeDocument reserves enough budget for document and every populated document already nested beneath it. The reservation happens before an adapter deep-clones the document into its parent response.