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

Method NoSyncReload

internal/freelist/shared.go:221–240  ·  view source on GitHub ↗
(pgIds common.Pgids)

Source from the content-addressed store, hash-verified

219}
220
221func (t *shared) NoSyncReload(pgIds common.Pgids) {
222 // Build a cache of only pending pages.
223 pcache := make(map[common.Pgid]struct{})
224 for _, txp := range t.pending {
225 for _, pendingID := range txp.ids {
226 pcache[pendingID] = struct{}{}
227 }
228 }
229
230 // Check each page in the freelist and build a new available freelist
231 // with any pages not in the pending lists.
232 a := []common.Pgid{}
233 for _, id := range pgIds {
234 if _, ok := pcache[id]; !ok {
235 a = append(a, id)
236 }
237 }
238
239 t.Init(a)
240}
241
242// reindex rebuilds the free cache based on available and pending free lists.
243func (t *shared) reindex() {

Callers 1

ReloadMethod · 0.95

Calls 1

InitMethod · 0.65

Tested by

no test coverage detected