Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) CAS(ctx context.Context, key string, ...) error
- func (c *Client) Delete(ctx context.Context, key string) error
- func (c *Client) Get(ctx context.Context, key string) (interface{}, error)
- func (c *Client) List(ctx context.Context, prefix string) ([]string, error)
- func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) bool)
- func (c *Client) WatchPrefix(ctx context.Context, key string, f func(string, interface{}) bool)
- type CloserFunc
- type Config
Constants ¶
This section is empty.
Variables ¶
var NopCloser = CloserFunc(func() error {
return nil
})
NopCloser does nothing.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements ring.KVClient for etcd.
func Mock ¶
func Mock(codec codec.Codec) (*Client, io.Closer, error)
Mock returns a Mock Etcd client. Inspired by https://github.com/ligato/cn-infra/blob/master/db/keyval/etcd/mocks/embeded_etcd.go.
func (*Client) CAS ¶
func (c *Client) CAS(ctx context.Context, key string, f func(in interface{}) (out interface{}, retry bool, err error)) error
CAS implements kv.Client.
func (*Client) Delete ¶ added in v1.1.0
func (c *Client) Delete(ctx context.Context, key string) error
Delete implements kv.Client.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, key string) (interface{}, error)
Get implements kv.Client.
func (*Client) List ¶ added in v1.1.0
func (c *Client) List(ctx context.Context, prefix string) ([]string, error)
List implements kv.Client.
func (*Client) WatchKey ¶
func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) bool)
WatchKey implements kv.Client.
func (*Client) WatchPrefix ¶
func (c *Client) WatchPrefix(ctx context.Context, key string, f func(string, interface{}) bool)
WatchPrefix implements kv.Client.
type CloserFunc ¶
type CloserFunc func() error
CloserFunc is like http.HandlerFunc but for io.Closers.
type Config ¶
type Config struct {
Endpoints []string `yaml:"endpoints"`
DialTimeout time.Duration `yaml:"dial_timeout"`
MaxRetries int `yaml:"max_retries"`
EnableTLS bool `yaml:"tls_enabled"`
CertFile string `yaml:"tls_cert_path"`
KeyFile string `yaml:"tls_key_path"`
TrustedCAFile string `yaml:"tls_ca_path"`
InsecureSkipVerify bool `yaml:"tls_insecure_skip_verify"`
}
Config for a new etcd.Client.
func (*Config) GetTLS ¶ added in v1.4.0
func (cfg *Config) GetTLS() (*tls.Config, error)
GetTLS sets the TLS config field with certs
func (*Config) RegisterFlags ¶
func (cfg *Config) RegisterFlags(f *flag.FlagSet)
RegisterFlags adds the flags required to config this to the given FlagSet.
func (*Config) RegisterFlagsWithPrefix ¶
func (cfg *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string)
RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet.