Help us shape the future of Go! Take the 2026 Go Developer Survey

control

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControlSize = 4096       // 1 page
	Magic       = 0x4C455943 // 'LEYC'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Magic      uint32
	Version    uint32
	Generation uint64 // Atomic
	ArenaPath  [256]byte
	ArenaSize  uint64
	Padding    [ControlSize - 272]byte // Pad to 4096 bytes
}

Block represents the memory-mapped control file. It must match the C layout exactly for interoperability.

type Controller

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

Controller manages the memory-mapped control file.

func OpenOrCreate

func OpenOrCreate(path string) (*Controller, error)

OpenOrCreate opens or creates a control file at the given path.

func (*Controller) Close

func (c *Controller) Close() error

Close unmaps and closes the control file.

func (*Controller) GetArenaPath

func (c *Controller) GetArenaPath() string

GetArenaPath returns the path to the currently active arena.

func (*Controller) GetGeneration

func (c *Controller) GetGeneration() uint64

GetGeneration returns the current generation ID atomically.

func (*Controller) SetArena

func (c *Controller) SetArena(path string, size, generation uint64) error

SetArena atomically updates the control block to point to a new arena.

Jump to

Keyboard shortcuts

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