Documentation
¶
Overview ¶
Package state provides functionality for storing and retrieving runner state across different environments (local filesystem, Kubernetes, etc.)
Index ¶
- Constants
- type LocalStore
- func (s *LocalStore) Delete(_ context.Context, name string) error
- func (s *LocalStore) Exists(_ context.Context, name string) (bool, error)
- func (s *LocalStore) GetReader(_ context.Context, name string) (io.ReadCloser, error)
- func (s *LocalStore) GetWriter(_ context.Context, name string) (io.WriteCloser, error)
- func (s *LocalStore) List(_ context.Context) ([]string, error)
- func (s *LocalStore) Load(_ context.Context, name string, w io.Writer) error
- func (s *LocalStore) Save(_ context.Context, name string, r io.Reader) error
- type Store
Constants ¶
const ( // RunConfigsDir is the directory name for storing run configurations RunConfigsDir = "runconfigs" // GroupConfigsDir is the directory name for storing group configurations GroupConfigsDir = "groups" )
const ( // DefaultAppName is the default application name used for XDG paths DefaultAppName = "toolhive" // FileExtension is the file extension for stored configurations FileExtension = ".json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore implements the Store interface using the local filesystem following the XDG Base Directory Specification
func NewLocalStore ¶
func NewLocalStore(appName string, storeName string) (*LocalStore, error)
NewLocalStore creates a new LocalStore with the given application name and store type If appName is empty, DefaultAppName will be used
func (*LocalStore) Delete ¶
func (s *LocalStore) Delete(_ context.Context, name string) error
Delete removes the data for the given name
func (*LocalStore) GetReader ¶
func (s *LocalStore) GetReader(_ context.Context, name string) (io.ReadCloser, error)
GetReader returns a reader for the state data
func (*LocalStore) GetWriter ¶
func (s *LocalStore) GetWriter(_ context.Context, name string) (io.WriteCloser, error)
GetWriter returns a writer for the state data
func (*LocalStore) List ¶
func (s *LocalStore) List(_ context.Context) ([]string, error)
List returns all available state names
type Store ¶
type Store interface { // Save stores the data for the given name from the provided reader Save(ctx context.Context, name string, r io.Reader) error // Load retrieves the data for the given name and writes it to the provided writer // Returns an error if the state doesn't exist Load(ctx context.Context, name string, w io.Writer) error // GetReader returns a reader for the state data // This is useful for streaming large state data GetReader(ctx context.Context, name string) (io.ReadCloser, error) // GetWriter returns a writer for the state data // This is useful for streaming large state data GetWriter(ctx context.Context, name string) (io.WriteCloser, error) // Delete removes the data for the given name Delete(ctx context.Context, name string) error // List returns all available state names List(ctx context.Context) ([]string, error) // Exists checks if data exists for the given name Exists(ctx context.Context, name string) (bool, error) }
Store defines the interface for runner state storage operations
func NewGroupConfigStore ¶
NewGroupConfigStore creates a store for group configurations
func NewRunConfigStore ¶
NewRunConfigStore creates a store for run configuration state