Documentation ¶
Index ¶
- type Config
- type ConfigManager
- func (m *ConfigManager) Close()
- func (m *ConfigManager) GetErr(file, md5 string) string
- func (m *ConfigManager) Load(file string)
- func (m *ConfigManager) LoadAll()
- func (m *ConfigManager) Start()
- func (m *ConfigManager) Watch(file string, f LoadFunc)
- func (m *ConfigManager) WatchAndLoad(file string, f LoadFunc)
- func (m *ConfigManager) WatchPrefix(file string, f LoadFuncWithName)
- type EtcdWatcher
- func (m *EtcdWatcher) GetFileNames() ([]string, error)
- func (m *EtcdWatcher) Init() error
- func (m *EtcdWatcher) IsExists(name string) bool
- func (m *EtcdWatcher) ReadFile(name string) ([]byte, error)
- func (m *EtcdWatcher) Start(closeCh chan struct{}, dispatch func(string, []byte))
- func (m *EtcdWatcher) Stop() error
- func (m *EtcdWatcher) WriteFile(name string, content []byte) error
- type FileWatcher
- func (m *FileWatcher) GetFileNames() (ret []string, err error)
- func (m *FileWatcher) Init() error
- func (m *FileWatcher) IsExists(name string) bool
- func (m *FileWatcher) ReadFile(name string) ([]byte, error)
- func (m *FileWatcher) Start(closeCh chan struct{}, dispatch func(string, []byte))
- func (m *FileWatcher) Stop() error
- func (m *FileWatcher) WriteFile(name string, content []byte) error
- type LoadData
- type LoadFunc
- type LoadFuncWithName
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigManager ¶
type ConfigManager struct { Etcd *etcd.Etcd Watcher Watcher // contains filtered or unexported fields }
func New ¶
func New(w Watcher) *ConfigManager
func (*ConfigManager) Close ¶
func (m *ConfigManager) Close()
func (*ConfigManager) GetErr ¶
func (m *ConfigManager) GetErr(file, md5 string) string
func (*ConfigManager) Load ¶
func (m *ConfigManager) Load(file string)
func (*ConfigManager) LoadAll ¶
func (m *ConfigManager) LoadAll()
func (*ConfigManager) Start ¶
func (m *ConfigManager) Start()
func (*ConfigManager) Watch ¶
func (m *ConfigManager) Watch(file string, f LoadFunc)
func (*ConfigManager) WatchAndLoad ¶
func (m *ConfigManager) WatchAndLoad(file string, f LoadFunc)
func (*ConfigManager) WatchPrefix ¶
func (m *ConfigManager) WatchPrefix(file string, f LoadFuncWithName)
type EtcdWatcher ¶
func NewEtcdWatcher ¶
func NewEtcdWatcher(et *etcd.Etcd) *EtcdWatcher
func (*EtcdWatcher) GetFileNames ¶
func (m *EtcdWatcher) GetFileNames() ([]string, error)
func (*EtcdWatcher) Init ¶
func (m *EtcdWatcher) Init() error
func (*EtcdWatcher) IsExists ¶
func (m *EtcdWatcher) IsExists(name string) bool
func (*EtcdWatcher) Start ¶
func (m *EtcdWatcher) Start(closeCh chan struct{}, dispatch func(string, []byte))
func (*EtcdWatcher) Stop ¶
func (m *EtcdWatcher) Stop() error
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
func NewFileWatcher ¶
func NewFileWatcher(path string) *FileWatcher
func (*FileWatcher) GetFileNames ¶
func (m *FileWatcher) GetFileNames() (ret []string, err error)
func (*FileWatcher) Init ¶
func (m *FileWatcher) Init() error
func (*FileWatcher) IsExists ¶
func (m *FileWatcher) IsExists(name string) bool
func (*FileWatcher) Start ¶
func (m *FileWatcher) Start(closeCh chan struct{}, dispatch func(string, []byte))
func (*FileWatcher) Stop ¶
func (m *FileWatcher) Stop() error
type LoadFunc ¶
func AtomicLoad ¶
xxconfig := Config[T]{} ConfigManager.Watch("config.json", AtomicLoad(&xxconfig, json.Unmarshal)) cfg := xxconfig.Get()
type LoadFuncWithName ¶
Click to show internal directories.
Click to hide internal directories.