storage

package
v6.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package storage provides opaque storage values for ordinary Floret hosts. Transactional backend implementation belongs to the advanced storage/spi package and cannot be used to query a runtime-owned Source.

Index

Constants

View Source
const (
	SQLiteMaintenanceActionNone              = "none"
	SQLiteMaintenanceActionVacuum            = "vacuum"
	SQLiteMaintenanceActionIncrementalVacuum = "incremental_vacuum"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLiteMaintenancePolicy

type SQLiteMaintenancePolicy struct {
	MinimumFileBytes    int64
	MinimumReclaimBytes int64
	MinimumReclaimRatio float64
	RetainedFreeBytes   int64
}

SQLiteMaintenancePolicy defines when an idle Floret SQLite backend should reclaim free pages before runtime.Open acquires the database.

type SQLiteMaintenanceResult

type SQLiteMaintenanceResult struct {
	Action string           `json:"action"`
	Before SQLiteSpaceUsage `json:"before"`
	After  SQLiteSpaceUsage `json:"after"`
	Reason string           `json:"reason"`
}

SQLiteMaintenanceResult describes one pre-open maintenance decision. A none action is a safe skip; schema and integrity failures are returned as errors because runtime startup must not hide corrupted storage.

func MaintainSQLite

func MaintainSQLite(ctx context.Context, path string, policy SQLiteMaintenancePolicy) (SQLiteMaintenanceResult, error)

MaintainSQLite reclaims free pages in an idle Floret SQLite backend. The caller must invoke it before runtime.Open and must ensure no live Host owns path. It never copies, replaces, or interprets opaque Floret records.

type SQLiteSpaceUsage

type SQLiteSpaceUsage struct {
	FileBytes        int64  `json:"file_bytes"`
	PageSize         int64  `json:"page_size"`
	PageCount        int64  `json:"page_count"`
	FreePageCount    int64  `json:"free_page_count"`
	ReclaimableBytes int64  `json:"reclaimable_bytes"`
	AutoVacuum       string `json:"auto_vacuum"`
}

SQLiteSpaceUsage reports physical SQLite page usage without inspecting opaque Floret records.

type Source

type Source storagebridge.Source

Source is an opaque storage configuration consumed exclusively by runtime.Open. It deliberately has no exported methods.

func Memory

func Memory() Source

Memory returns an in-memory Source suitable for production ephemeral use and deterministic tests.

func NewSource

func NewSource(source spi.Source) Source

NewSource seals an advanced backend implementation for use by runtime.Open. Applications that use only official storage constructors do not need this function.

func SQLite

func SQLite(path string) Source

SQLite returns a Source backed by the SQLite file at path. The physical database contains only backend metadata and opaque namespaced records.

Directories

Path Synopsis
Package spi defines the advanced physical storage implementation contract.
Package spi defines the advanced physical storage implementation contract.

Jump to

Keyboard shortcuts

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