lifecycle

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graveyard

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

func NewGraveyard

func NewGraveyard() *Graveyard

func (*Graveyard) Add

func (g *Graveyard) Add(seq uint64, pages []uint64)

Add schedules pages for retirement at the given sequence.

func (*Graveyard) Extract

func (g *Graveyard) Extract(minPinnedSeq, currentSeq, keepRecent uint64) []uint64

Extract returns pages that are safe to free. Condition: seq < minPinnedSeq AND seq < (currentSeq - keepRecent).

func (*Graveyard) ExtractBatchesUpTo

func (g *Graveyard) ExtractBatchesUpTo(minPinnedSeq, currentSeq, keepRecent uint64, maxIDs int) []RetiredBatch

ExtractBatchesUpTo returns up to maxIDs pages that are safe to free, grouped by retirement sequence so callers can reinsert on error.

Safe-to-free condition is the same as Extract:

  • retiredAtSeq < minPinnedSeq
  • retiredAtSeq < (currentSeq - keepRecent)

If maxIDs <= 0, all safe pages are returned.

func (*Graveyard) Reinsert

func (g *Graveyard) Reinsert(seq uint64, pages []uint64)

Reinsert adds pages back to the graveyard in order. Useful if freeing fails.

type ReaderRegistry

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

func NewReaderRegistry

func NewReaderRegistry() *ReaderRegistry

func (*ReaderRegistry) MinPinnedSeq

func (r *ReaderRegistry) MinPinnedSeq() uint64

MinPinnedSeq returns the lowest sequence number currently pinned by any reader. If no readers are active, returns MaxUint64 (meaning no restriction from readers).

func (*ReaderRegistry) Register

func (r *ReaderRegistry) Register(seq uint64) int64

Register adds a reader pinned to the given sequence. Returns a handle to be used for Unregister.

func (*ReaderRegistry) Unregister

func (r *ReaderRegistry) Unregister(id int64)

Unregister removes a reader.

type RetiredBatch

type RetiredBatch struct {
	Seq uint64
	IDs []uint64
}

RetiredBatch represents a set of pages retired at a specific commit sequence. It is returned by ExtractBatchesUpTo so callers can reinsert pages on failure.

Jump to

Keyboard shortcuts

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