MCPcopy Create free account
hub / github.com/DoNewsCode/core / WithKey

Function WithKey

config/remote/etcd/etcd.go:33–36  ·  view source on GitHub ↗

WithKey is a two-in-one coreOption. It uses the remote key on etcd as the source of configuration, and watches the change of that key for hot reloading.

(cfg clientv3.Config, key string, codec contract.Codec)

Source from the content-addressed store, hash-verified

31// WithKey is a two-in-one coreOption. It uses the remote key on etcd as the
32// source of configuration, and watches the change of that key for hot reloading.
33func WithKey(cfg clientv3.Config, key string, codec contract.Codec) (core.CoreOption, core.CoreOption) {
34 r := Provider(cfg, key)
35 return core.WithConfigStack(r, config.CodecParser{Codec: codec}), core.WithConfigWatcher(r)
36}
37
38// ReadBytes reads the contents of a key from etcd and returns the bytes.
39func (r *ETCD) ReadBytes() ([]byte, error) {

Callers 1

ExampleFunction · 0.92

Calls 3

WithConfigStackFunction · 0.92
WithConfigWatcherFunction · 0.92
ProviderFunction · 0.85

Tested by 1

ExampleFunction · 0.74