storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storage persists plugin-owned state. Host settings remain host-owned

Index

Constants

View Source
const MaximumBytes = statefile.MaximumBytes

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath(identity string) (string, error)

Resolve the default platform state path for an identity

func PathFor

func PathFor(root, identity string) (string, error)

PathFor isolates plugin state under the selected config root

func Write

func Write(path string, value any) ([]byte, error)

Encode and atomically write a versioned state envelope

Types

type Store

type Store struct {
	Path    string
	Version int
	Value   any
	Due     time.Time

	Dirty bool
	// contains filtered or unexported fields
}

func New

func New(path string, version int) *Store

Create a file store with an explicit version

func (*Store) Change

func (s *Store) Change(value any, now time.Time)

Stage changed state for a debounced write

func (*Store) Close

func (s *Store) Close() error

Force a final flush of pending state

func (*Store) Flush

func (s *Store) Flush(now time.Time, force bool) error

Flush pending state when forced or its deadline is due

func (*Store) Load

func (s *Store) Load(dst any) error

Load validated state without overwriting invalid saved input

Jump to

Keyboard shortcuts

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