Documentation
¶
Index ¶
- type Provider
- func (p *Provider) Database(name string) (storageiface.Database, error)
- func (p *Provider) Databases() (map[string]storageiface.Database, error)
- func (p *Provider) DefaultDatabase(globalDefaultName string) (storageiface.Database, error)
- func (p *Provider) Initialize(cfg *datav1.Databases, opts ...options.Option)
- func (p *Provider) RegisterDatabase(name string, db storageiface.Database)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider manages the lifecycle of database instances. It uses lazy-loading with sync.Once to ensure instances are created only when needed and in a concurrency-safe manner.
func NewProvider ¶
func NewProvider(logger runtimelog.Logger) *Provider
NewProvider creates a new, uninitialized Provider instance.
func (*Provider) Database ¶
func (p *Provider) Database(name string) (storageiface.Database, error)
Database returns a single database instance by name.
func (*Provider) Databases ¶
func (p *Provider) Databases() (map[string]storageiface.Database, error)
Databases returns a map of all available database instances. On the first call, it lazily creates and caches instances based on the configuration.
func (*Provider) DefaultDatabase ¶
func (p *Provider) DefaultDatabase(globalDefaultName string) (storageiface.Database, error)
DefaultDatabase returns the default database instance.
func (*Provider) Initialize ¶
Initialize configures the provider with the necessary configuration and options.
func (*Provider) RegisterDatabase ¶
func (p *Provider) RegisterDatabase(name string, db storageiface.Database)
RegisterDatabase allows for manual registration of a database instance.