remote

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Remote

type Remote struct {
	// contains filtered or unexported fields
}

Remote is a core.ConfProvider and contract.ConfigWatcher implementation to read and watch remote config key. The remote client uses etcd.

func Provider

func Provider(key string, clientConfig *clientv3.Config) *Remote

Provider create a *Remote

func (*Remote) Read

func (r *Remote) Read() (map[string]interface{}, error)

Read is not supported by the remote provider.

func (*Remote) ReadBytes

func (r *Remote) ReadBytes() ([]byte, error)

ReadBytes reads the contents of a key from etcd and returns the bytes.

func (*Remote) Watch

func (r *Remote) Watch(ctx context.Context, reload func() error) error

Watch watches the change to the remote key from etcd. If the key is edited or created, the reload function will be called. note the reload function should not just load the changes made within this key, but rather it should reload the whole config stack. For example, if the flag or env takes precedence over the config key, they should remain to be so after the key changes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL