milvus/pkg/util/paramtable/hook_config.go
SimFG 9b0ecbdca7
Support to replicate the mq message (#27240)
Signed-off-by: SimFG <bang.fu@zilliz.com>
2023-10-20 14:26:09 +08:00

40 lines
850 B
Go

package paramtable
import (
"go.uber.org/zap"
"github.com/milvus-io/milvus/pkg/config"
"github.com/milvus-io/milvus/pkg/log"
)
const hookYamlFile = "hook.yaml"
type hookConfig struct {
hookBase *BaseTable
SoPath ParamItem `refreshable:"false"`
SoConfig ParamGroup `refreshable:"true"`
}
func (h *hookConfig) init(base *BaseTable) {
h.hookBase = base
log.Info("hook config", zap.Any("hook", base.FileConfigs()))
h.SoPath = ParamItem{
Key: "soPath",
Version: "2.0.0",
DefaultValue: "",
}
h.SoPath.Init(base.mgr)
h.SoConfig = ParamGroup{
KeyPrefix: "",
Version: "2.2.0",
}
h.SoConfig.Init(base.mgr)
}
func (h *hookConfig) WatchHookWithPrefix(ident string, keyPrefix string, onEvent func(*config.Event)) {
h.hookBase.mgr.Dispatcher.RegisterForKeyPrefix(keyPrefix, config.NewHandler(ident, onEvent))
}