Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CfgLoader ¶
type CfgLoader interface { LoadConfig(ctx context.Context) (*entity.AppConf, error) GetConfigPath() string }
CfgLoader 接口的定义需要根据你的实际需求来实现。
type CfgManager ¶
type CfgManager struct {
// contains filtered or unexported fields
}
CfgManager 管理配置加载和监听配置变化,以及通知其他部分应用程序的错误。
func NewConfigManager ¶
func NewConfigManager(loader CfgLoader, watcher WatcherInterface, logger *zap.Logger, retryPolicy RetryPolicy) *CfgManager
NewConfigManager 创建新的配置管理器
func (*CfgManager) AddWatcher ¶
func (cm *CfgManager) AddWatcher(filePath string) error
AddWatcher 添加配置监听器
func (*CfgManager) ListenForConfigErrors ¶
func (cm *CfgManager) ListenForConfigErrors() <-chan error
ListenForConfigErrors 监听配置错误
func (*CfgManager) RemoveWatcher ¶
func (cm *CfgManager) RemoveWatcher(filePath string) error
RemoveWatcher 移除监听器
type FsNotifyWatcher ¶
type FsNotifyWatcher struct {
// contains filtered or unexported fields
}
func NewFsNotifyWatcher ¶
func NewFsNotifyWatcher(w WatcherInterface) *FsNotifyWatcher
func (*FsNotifyWatcher) Add ¶
func (f *FsNotifyWatcher) Add(path string) error
func (*FsNotifyWatcher) Close ¶
func (f *FsNotifyWatcher) Close() error
func (*FsNotifyWatcher) Errors ¶
func (f *FsNotifyWatcher) Errors() <-chan error
func (*FsNotifyWatcher) Events ¶
func (f *FsNotifyWatcher) Events() <-chan fsnotify.Event
func (*FsNotifyWatcher) Remove ¶
func (f *FsNotifyWatcher) Remove(path string) error
type JSONParser ¶
JSONParser JSON配置解析器
type RetryPolicy ¶
RetryPolicy 重试策略
Click to show internal directories.
Click to hide internal directories.