source

package
v4.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 69

Documentation

Overview

Package source is the interface for sources

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWatcherStopped is returned when source watcher has been stopped.
	ErrWatcherStopped = errors.New("watcher stopped")
)

Functions

This section is empty.

Types

type ChangeSet

type ChangeSet struct {
	Timestamp time.Time
	Checksum  string
	Format    string
	Source    string
	Data      []byte
}

ChangeSet represents a set of changes from a source.

func (*ChangeSet) Sum

func (c *ChangeSet) Sum() string

Sum returns the md5 checksum of the ChangeSet data.

type Option

type Option func(o *Options)

func WithClient

func WithClient(c client.Client) Option

WithClient sets the source client.

func WithEncoder

func WithEncoder(e encoder.Encoder) Option

WithEncoder sets the source encoder.

type Options

type Options struct {
	// Encoder
	Encoder encoder.Encoder

	// for alternative data
	Context context.Context

	// Client to use for RPC
	Client client.Client
}

func NewOptions

func NewOptions(opts ...Option) Options

type Source

type Source interface {
	Read() (*ChangeSet, error)
	Write(*ChangeSet) error
	Watch() (Watcher, error)
	String() string
}

Source is the source from which config is loaded.

type Watcher

type Watcher interface {
	Next() (*ChangeSet, error)
	Stop() error
}

Watcher watches a source for changes.

func NewNoopWatcher

func NewNoopWatcher() (Watcher, error)

NewNoopWatcher returns a watcher that blocks on Next() until Stop() is called.

Directories

Path Synopsis
cli
broker/memory module
cmd module
codec module
codec/bytes module
codec/grpc module
codec/json module
codec/jsonrpc module
codec/proto module
codec module
bytes module
grpc module
json module
jsonrpc module
proto module
protorpc module
configmap module
client/rpc module
consul module
encoder module
yaml module
envvar module
etcd module
Package file is a file source.
Package file is a file source.
broker module
broker/http module
broker/memory module
client module
client/mock module
client/rpc module
cmd module
codec module
codec/grpc module
codec/json module
codec/jsonrpc module
codec/proto module
config module
metadata module
registry module
registry/mdns module
selector module
selector/dns module
server module
server/rpc module
transport module
registry/mdns module
server module
server/rpc module
grpc module
Package memory is a memory source
Package memory is a memory source
broker module
broker/http module
broker/memory module
nacos module
client/mock module
reader module
service module
proto module
toml module
url module
yaml module
server/rpc module

Jump to

Keyboard shortcuts

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