Documentation
¶
Index ¶
Constants ¶
const ( AgentStatusOnline = types.AgentStatusOnline AgentStatusOffline = types.AgentStatusOffline AgentStatusError = types.AgentStatusError )
Re-export constants
Variables ¶
var AllStorageTypes = []string{
sqliteStorageType,
memoryStorageType,
}
AllStorageTypes defines all available application storage backends
Functions ¶
func IsStorageTypeSupported ¶
IsStorageTypeSupported checks if a storage type is supported
Types ¶
type AgentStatus ¶
type AgentStatus = types.AgentStatus
type ApplicationStoreFactory ¶
type ApplicationStoreFactory interface {
// CreateApplicationStore creates a types.ApplicationStore
CreateApplicationStore() (types.ApplicationStore, error)
// Initialize performs internal initialization of the factory, such as opening connections to the backend store.
// It is called after all configuration of the factory itself has been done.
Initialize(logger *zap.Logger) error
}
ApplicationStoreFactory defines an interface for a factory that can create application store implementations.
type Closer ¶
type Closer interface {
// Close closes the storage and releases resources.
Close() error
}
Closer defines an interface for closing storage resources.
type ConfigFilter ¶
type ConfigFilter = types.ConfigFilter
type Factory ¶
type Factory struct {
Config FactoryConfig
// contains filtered or unexported fields
}
Factory implements ApplicationStoreFactory interface as a meta-factory for application storage components. It provides a clean abstraction layer over concrete storage implementations, allowing easy switching between different storage backends (SQLite, Memory, PostgreSQL, etc.) without changing the main application code.
func NewFactory ¶
func NewFactory(config FactoryConfig) (*Factory, error)
NewFactory creates the meta-factory. It automatically creates and registers the factory for the configured storage type. Example usage:
config := applicationstore.ConfigFrom(appConfig)
factory, err := applicationstore.NewFactory(config)
if err != nil {
log.Fatal(err)
}
defer factory.Close()
func NewFactoryFromAppConfig ¶
NewFactoryFromAppConfig creates a new factory directly from app configuration This is a convenience function that combines ConfigFrom and NewFactory
func (*Factory) CreateApplicationStore ¶
func (f *Factory) CreateApplicationStore() (types.ApplicationStore, error)
CreateApplicationStore creates an application store using the configured storage type
func (*Factory) GetStorageType ¶
GetStorageType returns the configured storage type
type FactoryConfig ¶
FactoryConfig represents the configuration for the application store meta factory
func ConfigFrom ¶
func ConfigFrom(appConfig *config.Config) FactoryConfig
ConfigFrom creates a FactoryConfig from the app storage config
func DefaultConfig ¶
func DefaultConfig() FactoryConfig
DefaultConfig returns a default configuration