Documentation
¶
Overview ¶
Package state provides functionality for storing and retrieving runner state across different environments (local filesystem, Kubernetes, etc.)
Index ¶
- Constants
- func DeleteSavedRunConfig(ctx context.Context, name string) error
- func LoadRunConfigJSON(ctx context.Context, name string) (io.ReadCloser, error)
- 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)
- 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 ¶
func DeleteSavedRunConfig ¶ added in v0.2.4
DeleteSavedRunConfig deletes a saved run configuration
func LoadRunConfigJSON ¶ added in v0.2.4
LoadRunConfigJSON loads a run configuration from the state store and returns the raw reader
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
type Store ¶
type Store interface {
// 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