freelist

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocator

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

func New

func New(p *pager.Pager, head uint64) *Allocator

func (*Allocator) Alloc

func (a *Allocator) Alloc(hint uint64) (uint64, error)

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

func (a *Allocator) AllocMany(count int, hint uint64) ([]uint64, error)

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) Free

func (a *Allocator) Free(id uint64) error

Free adds a page to the freelist.

func (*Allocator) Head

func (a *Allocator) Head() uint64

func (*Allocator) SetFreelistRegion

func (a *Allocator) SetFreelistRegion(pages uint64, radius int)

func (*Allocator) SetHead

func (a *Allocator) SetHead(h uint64)

func (*Allocator) SetPreferAppend

func (a *Allocator) SetPreferAppend(prefer bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL