Documentation
¶
Index ¶
- Variables
- type Allocator
- func (a *Allocator) Alloc(hint uint64) (uint64, error)
- func (a *Allocator) AllocMany(count int, hint uint64) ([]uint64, error)
- func (a *Allocator) Free(id uint64) error
- func (a *Allocator) Head() uint64
- func (a *Allocator) SetFreelistRegion(pages uint64, radius int)
- func (a *Allocator) SetHead(h uint64)
- func (a *Allocator) SetPreferAppend(prefer bool)
- func (a *Allocator) Stats(pageLimit uint64) (Stats, error)
- type Stats
Constants ¶
This section is empty.
Variables ¶
View Source
var TestHookFreeBeforeChecksum func()
TestHookFreeBeforeChecksum is a test-only hook that fires after a freelist entry is written but before the page checksum is updated. It should remain nil in production.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
func (*Allocator) Alloc ¶
Alloc allocates a single page. hint is a page ID that the caller would like the new page to be close to. If hint is 0, the allocator uses its own heuristics (e.g. lastAlloc).
func (*Allocator) AllocMany ¶
AllocMany allocates up to count pages in one pass. It returns any allocated IDs even if an error occurs so callers can retire them.
func (*Allocator) SetFreelistRegion ¶
func (*Allocator) SetPreferAppend ¶
type Stats ¶ added in v0.2.0
Stats reports freelist metadata under the allocator lock.
func (Stats) ReclaimablePages ¶ added in v0.2.0
ReclaimablePages returns the total number of reclaimable pages tracked in the freelist.
Click to show internal directories.
Click to hide internal directories.