MCPcopy Create free account
hub / github.com/apache/dubbo-go / Load

Function Load

loader.go:69–98  ·  view source on GitHub ↗
(opts ...LoaderConfOption)

Source from the content-addressed store, hash-verified

67}
68
69func Load(opts ...LoaderConfOption) error {
70 conf := NewLoaderConf(opts...)
71 if conf.opts == nil {
72 koan := GetConfigResolver(conf)
73 koan = conf.MergeConfig(koan)
74 if err := koan.UnmarshalWithConf(instanceOptions.Prefix(),
75 instanceOptions, koanf.UnmarshalConf{Tag: "yaml"}); err != nil {
76 return err
77 }
78 } else {
79 instanceOptions = conf.opts
80 }
81
82 if err := instanceOptions.init(); err != nil {
83 return err
84 }
85
86 instance := &Instance{insOpts: instanceOptions}
87 // start the file watcher
88 once.Do(func() {
89 watcher.watcherWg.Add(1)
90 gr.GoSafely(&watcher.watcherWg, false, func() {
91 watch(conf, watcher.stopCh)
92 }, nil)
93 extension.AddCustomShutdownCallback(func() {
94 StopFileWatcher()
95 })
96 })
97 return instance.start()
98}
99
100func watch(conf *loaderConf, stopCh <-chan struct{}) {
101 watcher, err := fsnotify.NewWatcher()

Callers

nothing calls this directly

Calls 11

startMethod · 0.95
watchFunction · 0.85
StopFileWatcherFunction · 0.85
NewLoaderConfFunction · 0.70
GetConfigResolverFunction · 0.70
PrefixMethod · 0.65
DoMethod · 0.65
AddMethod · 0.65
MergeConfigMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected