Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1097828
feat(gprop): 添加通用配置管理器功能
LanceAdd Dec 25, 2025
df92fe9
refactor(gprop): 修正文档
LanceAdd Dec 25, 2025
6fe4a0d
refactor(gprop): 修正文档
LanceAdd Dec 25, 2025
a1a8d78
feat(gprop): 添加 MustLoadAndWatch 便捷方法
LanceAdd Dec 25, 2025
a9aa9dd
refactor(gcfg): 将gprop合并到gcfg
LanceAdd Dec 26, 2025
e889030
Apply gci import order changes
github-actions[bot] Dec 26, 2025
16ac84b
docs(config): 添加测试配置结构体文档注释
LanceAdd Dec 26, 2025
3b10042
test(gcfg): 更新单元测试以使用内容适配器
LanceAdd Dec 26, 2025
b8d4de4
Merge branch 'master' into feature/gprop
LanceAdd Dec 26, 2025
25fb2bb
feat(gcfg): 添加配置器重用功能支持
LanceAdd Dec 29, 2025
fd4a292
refactor(os): 删除空白行
LanceAdd Dec 29, 2025
93fa6ff
Merge branch 'master' into feature/gprop
LanceAdd Dec 29, 2025
bbdf6ad
feat(gcfg): 添加配置器指针获取方法
LanceAdd Dec 29, 2025
6062c0b
feat(gcfg): 添加配置监视器的启停功能
LanceAdd Dec 31, 2025
03b79e0
feat(config): 添加配置监听器状态检查功能
LanceAdd Jan 1, 2026
d02ca2a
refactor(config): 统一配置监听器函数类型定义
LanceAdd Jan 2, 2026
64b0a31
fix(config): 修复配置重用导致的数据竞争问题
LanceAdd Jan 4, 2026
752b41a
Merge remote-tracking branch 'origin/feature/gprop' into feature/gprop
LanceAdd Jan 4, 2026
607c1ba
test(configurator): 单元测试修正
LanceAdd Jan 4, 2026
e328f23
Merge branch 'master' into feature/gprop
houseme Jan 5, 2026
9fa6474
Merge branch 'master' into feature/gprop
LanceAdd Jan 10, 2026
e2a894c
refactor(gcfg): 简化 WatcherFunc 类型定义
LanceAdd Jan 13, 2026
bdfac6b
Merge branch 'master' into feature/gprop
LanceAdd Jan 15, 2026
c73dcb3
Merge branch 'gogf:master' into feature/gprop
LanceAdd Jan 16, 2026
09f4edd
Merge branch 'gogf:master' into feature/gprop
LanceAdd Jan 16, 2026
1b1589d
Merge branch 'master' into feature/gprop
LanceAdd Jan 16, 2026
f8ad883
Merge branch 'master' into feature/gprop
LanceAdd Jan 19, 2026
b36f981
refactor(gcfg): 将配置管理器重命名为加载器
LanceAdd Jan 19, 2026
414038a
refactor(os/gcfg): 将Loader结构体方法中的接收器变量从c改为l
LanceAdd Jan 19, 2026
5dbe8b0
refactor(os/gcfg): 修改Loader方法以支持链式调用
LanceAdd Jan 20, 2026
0e09f26
Merge branch 'master' into feature/gprop
LanceAdd Jan 20, 2026
1753ed2
Merge branch 'master' into feature/gprop
LanceAdd Jan 20, 2026
df615b4
Merge branch 'master' into feature/gprop
LanceAdd Jan 20, 2026
46ef66f
Merge branch 'master' into feature/gprop
houseme Jan 21, 2026
0e53620
refactor(gcfg): 重构配置加载器错误处理机制
LanceAdd Jan 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion contrib/config/apollo/apollo.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (c *Client) updateLocalValue(ctx context.Context) (err error) {
}

// AddWatcher adds a watcher for the specified configuration file.
func (c *Client) AddWatcher(name string, f func(ctx context.Context)) {
func (c *Client) AddWatcher(name string, f gcfg.WatcherFunc) {
c.watchers.Add(name, f)
}

Expand All @@ -193,6 +193,11 @@ func (c *Client) GetWatcherNames() []string {
return c.watchers.GetNames()
}

// IsWatching checks whether the watcher with the specified name is registered.
func (c *Client) IsWatching(name string) bool {
return c.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (c *Client) notifyWatchers(ctx context.Context) {
c.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion contrib/config/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (c *Client) startAsynchronousWatch(plan *watch.Plan) {
}

// AddWatcher adds a watcher for the specified configuration file.
func (c *Client) AddWatcher(name string, f func(ctx context.Context)) {
func (c *Client) AddWatcher(name string, f gcfg.WatcherFunc) {
c.watchers.Add(name, f)
}

Expand All @@ -221,6 +221,11 @@ func (c *Client) GetWatcherNames() []string {
return c.watchers.GetNames()
}

// IsWatching checks whether the watcher with the specified name is registered.
func (c *Client) IsWatching(name string) bool {
return c.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (c *Client) notifyWatchers(ctx context.Context) {
c.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion contrib/config/kubecm/kubecm.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (c *Client) startAsynchronousWatch(ctx context.Context, namespace string, w
}

// AddWatcher adds a watcher for the specified configuration file.
func (c *Client) AddWatcher(name string, f func(ctx context.Context)) {
func (c *Client) AddWatcher(name string, f gcfg.WatcherFunc) {
c.watchers.Add(name, f)
}

Expand All @@ -213,6 +213,11 @@ func (c *Client) GetWatcherNames() []string {
return c.watchers.GetNames()
}

// IsWatching checks whether the watcher with the specified name is registered.
func (c *Client) IsWatching(name string) bool {
return c.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (c *Client) notifyWatchers(ctx context.Context) {
c.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion contrib/config/nacos/nacos.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (c *Client) addWatcher() error {
}

// AddWatcher adds a watcher for the specified configuration file.
func (c *Client) AddWatcher(name string, f func(ctx context.Context)) {
func (c *Client) AddWatcher(name string, f gcfg.WatcherFunc) {
c.watchers.Add(name, f)
}

Expand All @@ -166,6 +166,11 @@ func (c *Client) GetWatcherNames() []string {
return c.watchers.GetNames()
}

// IsWatching checks whether the watcher with the specified name is registered.
func (c *Client) IsWatching(name string) bool {
return c.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (c *Client) notifyWatchers(ctx context.Context) {
c.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion contrib/config/polaris/polaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (c *Client) startAsynchronousWatch(ctx context.Context, changeChan <-chan m
}

// AddWatcher adds a watcher for the specified configuration file.
func (c *Client) AddWatcher(name string, f func(ctx context.Context)) {
func (c *Client) AddWatcher(name string, f gcfg.WatcherFunc) {
c.watchers.Add(name, f)
}

Expand All @@ -201,6 +201,11 @@ func (c *Client) GetWatcherNames() []string {
return c.watchers.GetNames()
}

// IsWatching checks whether the watcher with the specified name is registered.
func (c *Client) IsWatching(name string) bool {
return c.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (c *Client) notifyWatchers(ctx context.Context) {
c.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion os/gcfg/gcfg_adaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ type Adapter interface {
Data(ctx context.Context) (data map[string]any, err error)
}

// WatcherFunc is the callback function type for configuration watchers.
type WatcherFunc = func(context.Context)

// WatcherAdapter is the interface for configuration watcher.
type WatcherAdapter interface {
// AddWatcher adds a watcher function for specified `pattern` and `resource`.
AddWatcher(name string, fn func(ctx context.Context))
AddWatcher(name string, fn WatcherFunc)
// RemoveWatcher removes the watcher function for specified `pattern` and `resource`.
RemoveWatcher(name string)
// GetWatcherNames returns all watcher names.
GetWatcherNames() []string
// IsWatching checks and returns whether the specified `pattern` is watching.
IsWatching(name string) bool
}
7 changes: 6 additions & 1 deletion os/gcfg/gcfg_adapter_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (a *AdapterContent) Data(ctx context.Context) (data map[string]any, err err
}

// AddWatcher adds a watcher for the specified configuration file.
func (a *AdapterContent) AddWatcher(name string, fn func(ctx context.Context)) {
func (a *AdapterContent) AddWatcher(name string, fn WatcherFunc) {
a.watchers.Add(name, fn)
}

Expand All @@ -100,6 +100,11 @@ func (a *AdapterContent) GetWatcherNames() []string {
return a.watchers.GetNames()
}

// IsWatching checks and returns whether the specified `name` is watching.
func (a *AdapterContent) IsWatching(name string) bool {
return a.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (a *AdapterContent) notifyWatchers(ctx context.Context) {
a.watchers.Notify(ctx)
Expand Down
7 changes: 6 additions & 1 deletion os/gcfg/gcfg_adapter_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (a *AdapterFile) getJson(fileNameOrPath ...string) (configJson *gjson.Json,
}

// AddWatcher adds a watcher for the specified configuration file.
func (a *AdapterFile) AddWatcher(name string, fn func(ctx context.Context)) {
func (a *AdapterFile) AddWatcher(name string, fn WatcherFunc) {
a.watchers.Add(name, fn)
}

Expand All @@ -346,6 +346,11 @@ func (a *AdapterFile) GetWatcherNames() []string {
return a.watchers.GetNames()
}

// IsWatching checks and returns whether the specified `name` is watching.
func (a *AdapterFile) IsWatching(name string) bool {
return a.watchers.IsWatching(name)
}

// notifyWatchers notifies all watchers.
func (a *AdapterFile) notifyWatchers(ctx context.Context) {
a.watchers.Notify(ctx)
Expand Down
Loading
Loading