Documentation
¶
Overview ¶
Package storage provides a unified interface for various storage solutions including cache, database, and file storage.
Index ¶
- Constants
- func NewCaches(cachesConfig *datav1.Caches) (map[string]storageiface.Cache, string, error)
- func NewCachesFromConfigs(configs map[string]*cachev1.CacheConfig) (map[string]storageiface.Cache, error)
- func NewDatabases(databasesConfig *datav1.Databases) (map[string]storageiface.Database, string, error)
- func NewDatabasesFromConfigs(configs map[string]*databasev1.DatabaseConfig) (map[string]storageiface.Database, error)
- func NewObjectStores(objectstoresConfig *datav1.ObjectStores) (map[string]storageiface.ObjectStore, string, error)
- func NewObjectStoresFromConfigs(configs map[string]*ossv1.ObjectStoreConfig) (map[string]storageiface.ObjectStore, error)
- type Provider
Constants ¶
const (
Module = "storage"
)
Variables ¶
This section is empty.
Functions ¶
func NewCaches ¶ added in v0.2.12
NewCaches creates a map of cache instances and determines the default cache name from a datav1.Caches configuration object.
func NewCachesFromConfigs ¶ added in v0.2.12
func NewCachesFromConfigs(configs map[string]*cachev1.CacheConfig) (map[string]storageiface.Cache, error)
NewCachesFromConfigs creates a map of cache instances from a map of cache configurations.
func NewDatabases ¶ added in v0.2.12
func NewDatabases(databasesConfig *datav1.Databases) (map[string]storageiface.Database, string, error)
NewDatabases creates a map of database instances and determines the default database name from a datav1.Databases configuration object.
func NewDatabasesFromConfigs ¶ added in v0.2.12
func NewDatabasesFromConfigs(configs map[string]*databasev1.DatabaseConfig) (map[string]storageiface.Database, error)
NewDatabasesFromConfigs creates a map of database instances from a map of database configurations.
func NewObjectStores ¶ added in v0.2.13
func NewObjectStores(objectstoresConfig *datav1.ObjectStores) (map[string]storageiface.ObjectStore, string, error)
NewObjectStores creates a map of object store instances and determines the default object store name from a datav1.ObjectStores configuration object.
func NewObjectStoresFromConfigs ¶ added in v0.2.13
func NewObjectStoresFromConfigs(configs map[string]*ossv1.ObjectStoreConfig) (map[string]storageiface.ObjectStore, error)
NewObjectStoresFromConfigs creates a map of object store instances from a map of object store configurations.
Types ¶
type Provider ¶ added in v0.2.13
type Provider interface {
Cache(name string) (storageiface.Cache, error)
DefaultCache() (storageiface.Cache, error)
Database(name string) (storageiface.Database, error)
DefaultDatabase() (storageiface.Database, error)
ObjectStore(name string) (storageiface.ObjectStore, error)
DefaultObjectStore() (storageiface.ObjectStore, error)
}
func New ¶
func New(sc interfaces.StructuredConfig) (Provider, error)
New creates a new storage provider instance based on the provided structured configuration. This function is primarily for backward compatibility or when a custom interfaces.StructuredConfig implementation is used. For most cases, NewProvider is recommended.
func NewProvider ¶ added in v0.2.12
NewProvider creates a new storage provider instance based on the provided decoded DataConfig. This is the recommended way to initialize a full storage provider when you have the configuration already decoded.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache provides a factory function to create Cache instances.
|
Package cache provides a factory function to create Cache instances. |
|
Package database implements the functions, types, and interfaces for the module.
|
Package database implements the functions, types, and interfaces for the module. |
|
Package objectstore provides a factory function to create ObjectStore instances.
|
Package objectstore provides a factory function to create ObjectStore instances. |