etcd

package
v2.0.2-sonek Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdConfiger

type EtcdConfiger struct {
	config.BaseConfiger
	// contains filtered or unexported fields
}

func (*EtcdConfiger) DIY

func (e *EtcdConfiger) DIY(key string) (interface{}, error)

DIY return the original response from etcd be careful when you decide to use this

func (*EtcdConfiger) GetSection

func (e *EtcdConfiger) GetSection(section string) (map[string]string, error)

GetSection in this implementation, we use section as prefix

func (*EtcdConfiger) OnChange

func (e *EtcdConfiger) OnChange(key string, fn func(value string))

TODO remove this before release v2.0.0

func (*EtcdConfiger) SaveConfigFile

func (e *EtcdConfiger) SaveConfigFile(filename string) error

func (*EtcdConfiger) Set

func (e *EtcdConfiger) Set(key, val string) error

Set do nothing and return an error I think write data to remote config center is not a good practice

func (*EtcdConfiger) Sub

func (e *EtcdConfiger) Sub(key string) (config.Configer, error)

Sub return an sub configer.

func (*EtcdConfiger) Unmarshaler

func (e *EtcdConfiger) Unmarshaler(prefix string, obj interface{}, opt ...config.DecodeOption) error

Unmarshaler is not very powerful because we lost the type information when we get configuration from etcd for example, when we got "5", we are not sure whether it's int 5, or it's string "5" TODO(support more complicated decoder)

type EtcdConfigerProvider

type EtcdConfigerProvider struct {
}

func (*EtcdConfigerProvider) Parse

func (provider *EtcdConfigerProvider) Parse(key string) (config.Configer, error)

Parse = ParseData([]byte(key)) key must be json

func (*EtcdConfigerProvider) ParseData

func (provider *EtcdConfigerProvider) ParseData(data []byte) (config.Configer, error)

ParseData try to parse key as clientv3.Config, using this to build etcdClient

Jump to

Keyboard shortcuts

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