etcd

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStore

func NewStore(etcdKV *clientv3.Client, opts Options) (kv.TxnStore, error)

NewStore creates a kv store based on etcd

Types

type CacheFileFn

type CacheFileFn func(namespace string) string

CacheFileFn is a function to generate cache file path

type Options

type Options interface {
	// RequestTimeout is the timeout for etcd requests
	RequestTimeout() time.Duration
	// SetRequestTimeout sets the RequestTimeout
	SetRequestTimeout(t time.Duration) Options

	// InstrumentsOptions is the instrument options
	InstrumentsOptions() instrument.Options
	// SetInstrumentsOptions sets the InstrumentsOptions
	SetInstrumentsOptions(iopts instrument.Options) Options

	// RetryOptions is the retry options
	RetryOptions() retry.Options
	// SetRetryOptions sets the RetryOptions
	SetRetryOptions(ropts retry.Options) Options

	// WatchChanCheckInterval will be used to periodically check if a watch chan
	// is no longer being subscribed and should be closed
	WatchChanCheckInterval() time.Duration
	// SetWatchChanCheckInterval sets the WatchChanCheckInterval
	SetWatchChanCheckInterval(t time.Duration) Options

	// WatchChanResetInterval is the delay before resetting the etcd watch chan
	WatchChanResetInterval() time.Duration
	// SetWatchChanResetInterval sets the WatchChanResetInterval
	SetWatchChanResetInterval(t time.Duration) Options

	// WatchChanInitTimeout is the timeout for a watchChan initialization
	WatchChanInitTimeout() time.Duration
	// SetWatchChanInitTimeout sets the WatchChanInitTimeout
	SetWatchChanInitTimeout(t time.Duration) Options

	// WatchWithRevision is the revision that watch requests will start from.
	WatchWithRevision() int64

	// EnableFastGets returns whether to use clientv3.WithSerializable() option to speed up gets.
	EnableFastGets() bool
	// SetEnableFastGets sets clientv3.WithSerializable() to speed up gets, but can fetch stale data.
	SetEnableFastGets(enabled bool) Options

	// SetWatchWithRevision sets the revision that watch requests will start
	// from.
	SetWatchWithRevision(rev int64) Options

	// Prefix is the prefix for each key
	Prefix() string
	// SetPrefix sets the prefix
	SetPrefix(s string) Options
	// ApplyPrefix applies the prefix to the key
	ApplyPrefix(key string) string

	// CacheFileDir is the dir for cache.
	CacheFileFn() CacheFileFn
	// SetCacheFileDir sets the CacheFileDir
	SetCacheFileFn(fn CacheFileFn) Options

	SetNewDirectoryMode(fm os.FileMode) Options
	NewDirectoryMode() os.FileMode

	// Validate validates the Options
	Validate() error
}

Options are options for the client of the kv store

func NewOptions

func NewOptions() Options

NewOptions creates a sane default Option

Jump to

Keyboard shortcuts

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