store

package
v0.0.0-...-a14a4d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package store is only used in the internal implement of manager, not a public api.

Package store is only used in the internal implement of manager, not a public api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(value interface{}) (string, error)

ToString ...

Types

type ConfigStore

type ConfigStore struct {
	// contains filtered or unexported fields
}

ConfigStore - the config data store

func NewConfigStore

func NewConfigStore(cfgDriver Driver) *ConfigStore

NewConfigStore create config store

func (*ConfigStore) Get

Get - Get config data from current store

func (*ConfigStore) GetAnyType

func (c *ConfigStore) GetAnyType(key string) (interface{}, error)

GetAnyType get interface{} type for config items

func (*ConfigStore) Load

func (c *ConfigStore) Load(ctx context.Context) error

Load - Load data from driver, all user config in the store will be refreshed

func (*ConfigStore) Save

func (c *ConfigStore) Save(ctx context.Context) error

Save - Save all data in current store

func (*ConfigStore) Set

func (c *ConfigStore) Set(key string, value metadata.ConfigureValue) error

Set - Set configure value in store, not saved to config driver

func (*ConfigStore) Update

func (c *ConfigStore) Update(ctx context.Context, cfgMap map[string]interface{}) error

Update - Only update specified settings in cfgMap in store and driver

type Driver

type Driver interface {
	// Load - load config item from config driver
	Load(ctx context.Context) (map[string]interface{}, error)
	// Save - save config item into config driver
	Save(ctx context.Context, cfg map[string]interface{}) error
}

Driver the interface to save/load config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL