internal

package
v0.0.0-...-cc58326 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestWatcher

func NewTestWatcher(t *testing.T) (*Watch, TestStore)

Types

type Store

type Store interface {
	Get(context.Context, string) ([]byte, error)
}

Store is an interface of all functionalities a store must complete

type TestStore

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

TestStore - not concurrency safe

func (TestStore) Get

func (t TestStore) Get(_ context.Context, key string) ([]byte, error)

func (*TestStore) Set

func (t *TestStore) Set(key string, value []byte)

type Watch

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

func NewWatcher

func NewWatcher(t string, config *common.Config, store Store) (*Watch, error)

NewWatcher accepts a store name t, watcher configurations, and a store and returns a new watch with all watcher mechanisms.

func (*Watch) Close

func (w *Watch) Close() error

Close closes all running watchers and returns an error if a CloseTimeout is exceeded. if the CloseTimeout is zero, the close method waits indefinitely for the close operation to complete

func (*Watch) CollectStats

func (w *Watch) CollectStats(exporter common.StatsCollector)

func (*Watch) Watch

func (w *Watch) Watch(ctx context.Context, key string) <-chan []byte

Watch return s a <-chan []byte on which all new detected configuration changes are pushed. Watch the initial value for watch will always be nil, if the key on the associated store does not exist or is empty. Watch can be called multiple times on the same key at different places, or on multiple different keys on the same store.

type Watcher

type Watcher interface {
	io.Closer

	Watch(context.Context, string) <-chan []byte
	CollectStats(common.StatsCollector)
}

Jump to

Keyboard shortcuts

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