1 Star 0 Fork 0

qp84/aiui-iot-core

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
loader.go 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
cnxkey 提交于 2025-02-14 19:12 +08:00 . aiui-iot-core
// package loader manages loading from multiple sources
package loader
import (
"context"
"gitee.com/qp84/aiui-iot-core/config/tool/reader"
"gitee.com/qp84/aiui-iot-core/config/tool/source"
)
// Loader manages loading sources
type Loader interface {
// Close Stop the loader
Close() error
// Load the sources
Load(...source.Source) error
// Snapshot A Snapshot of loaded config
Snapshot() (*Snapshot, error)
// Sync Force sync of sources
Sync() error
// Watch for changes
Watch(...string) (Watcher, error)
// String Name of loader
String() string
}
// Watcher lets you watch sources and returns a merged ChangeSet
type Watcher interface {
// Next First call to next may return the current Snapshot
// If you are watching a path then only the data from
// that path is returned.
Next() (*Snapshot, error)
// Stop watching for changes
Stop() error
}
// Snapshot is a merged ChangeSet
type Snapshot struct {
// The merged ChangeSet
ChangeSet *source.ChangeSet
// Version Deterministic and comparable version of the snapshot
Version string
}
type Options struct {
Reader reader.Reader
Source []source.Source
// for alternative data
Context context.Context
}
type Option func(o *Options)
// Copy snapshot
func Copy(s *Snapshot) *Snapshot {
cs := *(s.ChangeSet)
return &Snapshot{
ChangeSet: &cs,
Version: s.Version,
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qp84/aiui-iot-core.git
git@gitee.com:qp84/aiui-iot-core.git
qp84
aiui-iot-core
aiui-iot-core
v1.0.2

搜索帮助