MCPcopy
hub / github.com/etcd-io/bbolt / Read

Method Read

internal/freelist/shared.go:257–276  ·  view source on GitHub ↗
(p *common.Page)

Source from the content-addressed store, hash-verified

255}
256
257func (t *shared) Read(p *common.Page) {
258 if !p.IsFreelistPage() {
259 panic(fmt.Sprintf("invalid freelist page: %d, page type is %s", p.Id(), p.Typ()))
260 }
261
262 ids := p.FreelistPageIds()
263
264 // Copy the list of page ids from the freelist.
265 if len(ids) == 0 {
266 t.Init([]common.Pgid{})
267 } else {
268 // copy the ids, so we don't modify on the freelist page directly
269 idsCopy := make([]common.Pgid, len(ids))
270 copy(idsCopy, ids)
271 // Make sure they're sorted.
272 sort.Sort(common.Pgids(idsCopy))
273
274 t.Init(idsCopy)
275 }
276}
277
278func (t *shared) EstimatedWritePageSize() int {
279 n := t.Count()

Callers 1

ReloadMethod · 0.95

Calls 6

PgidsTypeAlias · 0.92
IsFreelistPageMethod · 0.80
IdMethod · 0.80
TypMethod · 0.80
FreelistPageIdsMethod · 0.80
InitMethod · 0.65

Tested by

no test coverage detected