components

package
v0.0.0-...-d28bcca Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryPoints      = "entryPoints"
	Username         = "username"
	Password         = "password"
	TimeOut          = "timeout"
	HostName         = "host"
	HostSchema       = "127.0.0.1:2380"
	DotDiv           = ","
	CnfFile          = "file"
	DefaultTimeOut   = 10 * time.Second
	WatchEventPrefix = "watcher."
)

Variables

View Source
var (
	EmptyGet = errors.New("empty get")
)

Functions

This section is empty.

Types

type ApiContext

type ApiContext interface {
	GetContext() context.Context
	GetOptions() []clientv3.OpOption
}

ApiContext 接口

type ApiContextImpl

type ApiContextImpl struct {
	Ctx           context.Context
	CancelHandler context.CancelFunc
	Opts          []clientv3.OpOption
}

ApiContextImpl 参数上下文

func (*ApiContextImpl) GetContext

func (this *ApiContextImpl) GetContext() context.Context

func (*ApiContextImpl) GetOptions

func (this *ApiContextImpl) GetOptions() []clientv3.OpOption

func (*ApiContextImpl) SetContext

func (this *ApiContextImpl) SetContext(ctx context.Context, fn ...context.CancelFunc) ApiContext

func (*ApiContextImpl) SetOptions

func (this *ApiContextImpl) SetOptions(option ...clientv3.OpOption) ApiContext

type EtcdStorageImpl

type EtcdStorageImpl struct {
	ApiClient *clientv3.Client
	Options   []Option
	Ctx       context.Context
}

func (*EtcdStorageImpl) Del

func (this *EtcdStorageImpl) Del(keys []string, apiContext ...ApiContext) error

func (*EtcdStorageImpl) Get

func (this *EtcdStorageImpl) Get(key string, apiCtx ...ApiContext) (string, error)

func (*EtcdStorageImpl) GetWatcher

func (this *EtcdStorageImpl) GetWatcher() clientv3.Watcher

func (*EtcdStorageImpl) Pull

func (this *EtcdStorageImpl) Pull(keys []string, apiContext ...ApiContext) (map[string]string, error)

func (*EtcdStorageImpl) Set

func (this *EtcdStorageImpl) Set(key string, value string, apiContext ...ApiContext) error

func (*EtcdStorageImpl) SetContext

func (this *EtcdStorageImpl) SetContext(ctx context.Context) Storage

func (*EtcdStorageImpl) SetOptions

func (this *EtcdStorageImpl) SetOptions(options ...Option)

type Option

type Option interface {
	Key() string
	V() string
	Value() interface{}
	Copy() Option
}

func NewOption

func NewOption(key, value string) Option

type OptionImpl

type OptionImpl struct {
	K, Val string
}

func (*OptionImpl) Copy

func (this *OptionImpl) Copy() Option

func (*OptionImpl) Key

func (this *OptionImpl) Key() string

func (*OptionImpl) String

func (this *OptionImpl) String() string

func (*OptionImpl) V

func (this *OptionImpl) V() string

func (*OptionImpl) Value

func (this *OptionImpl) Value() interface{}

type Registry

type Registry interface {
	Storage
	Boot() error
	SetFile(file string) Registry
	SetEntryPort(host string, options ...Option)
	Save(file string, handlers ...func(fs *os.File, storage Storage) error) error
}

func RegistryOf

func RegistryOf(options ...Option) Registry

type RegistryImpl

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

func NewRegistry

func NewRegistry() *RegistryImpl

func (*RegistryImpl) Boot

func (this *RegistryImpl) Boot() error

func (*RegistryImpl) Del

func (this *RegistryImpl) Del(keys []string, apiContext ...ApiContext) error

func (*RegistryImpl) Get

func (this *RegistryImpl) Get(key string, apiContext ...ApiContext) (string, error)

func (*RegistryImpl) GetWatcher

func (this *RegistryImpl) GetWatcher() clientv3.Watcher

func (*RegistryImpl) On

func (this *RegistryImpl) On(name string, handler func(config *viper.Viper, storage Storage) error)

func (*RegistryImpl) Pull

func (this *RegistryImpl) Pull(keys []string, apiContext ...ApiContext) (map[string]string, error)

func (*RegistryImpl) RegisterEnv

func (this *RegistryImpl) RegisterEnv(object map[string]string) int

RegisterEnv 注册环境变量

func (*RegistryImpl) Save

func (this *RegistryImpl) Save(file string, handlers ...func(fs *os.File, storage Storage) error) error

func (*RegistryImpl) Set

func (this *RegistryImpl) Set(key string, value string, apiContext ...ApiContext) error

func (*RegistryImpl) SetEntryPort

func (this *RegistryImpl) SetEntryPort(host string, options ...Option)

func (*RegistryImpl) SetFile

func (this *RegistryImpl) SetFile(file string) Registry

func (*RegistryImpl) SetOptions

func (this *RegistryImpl) SetOptions(options ...Option)

func (*RegistryImpl) Watch

func (this *RegistryImpl) Watch()

type Storage

type Storage interface {
	Del(keys []string, apiContext ...ApiContext) error
	SetOptions(options ...Option)
	Get(key string, apiContext ...ApiContext) (string, error)
	Set(key string, value string, apiContext ...ApiContext) error
	GetWatcher() clientv3.Watcher
	Pull(keys []string, apiContext ...ApiContext) (map[string]string, error)
}

func NewEtcdStorage

func NewEtcdStorage(option ...Option) Storage

Jump to

Keyboard shortcuts

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