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 ¶
const ( SQLiteMaintenanceActionNone = "none" SQLiteMaintenanceActionVacuum = "vacuum" SQLiteMaintenanceActionIncrementalVacuum = "incremental_vacuum" )
Variables ¶
var ( ErrUnsupportedSQLiteFormat = errors.New("unsupported Floret SQLite format") ErrSQLiteTooNew = errors.New("Floret SQLite format is newer than supported") ErrSQLiteIntegrity = errors.New("Floret SQLite integrity check failed") )
SQLite inspection errors distinguish unsupported formats from damaged data.
Functions ¶
func BackupSQLite ¶ added in v7.6.0
BackupSQLite writes a new, complete SQLite snapshot, including committed WAL records. The caller must stop all writers before calling and retain that exclusion when coordinating a snapshot with other stores. Existing targets are never overwritten. No runtime Host may own the source.
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.