etcd

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 17 Imported by: 1 module, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEtcdDataDir = "/opt/kip/data"
)

Functions

This section is empty.

Types

type EtcdServer

type EtcdServer struct {
	ConfigFile string
	DataDir    string
	Proc       *embed.Etcd
	Client     *SimpleEtcd
}

func (*EtcdServer) Start

func (s *EtcdServer) Start(quit <-chan struct{}, wg *sync.WaitGroup) error

type SimpleEtcd

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

func NewEtcdClient

func NewEtcdClient(endpoints []string, certFile, keyFile, caFile string) (*SimpleEtcd, error)

func SetupEmbeddedEtcdTest

func SetupEmbeddedEtcdTest() (*SimpleEtcd, func(), error)

func (*SimpleEtcd) AtomicPut

func (s *SimpleEtcd) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error)

func (*SimpleEtcd) Client

func (s *SimpleEtcd) Client() *clientv3.Client

func (*SimpleEtcd) Delete

func (s *SimpleEtcd) Delete(key string) error

func (*SimpleEtcd) DeleteTree

func (s *SimpleEtcd) DeleteTree(keyPrefix string) error

func (*SimpleEtcd) Exists

func (s *SimpleEtcd) Exists(key string) (bool, error)

func (*SimpleEtcd) External

func (s *SimpleEtcd) External() bool

func (*SimpleEtcd) Get

func (s *SimpleEtcd) Get(key string) (pair *store.KVPair, err error)

I'm pretty sure we can get away with serializable calls here K8s allows it but it's off by default. Might want to make this a config flag (k8s flag: etcd-quorum-read)

func (*SimpleEtcd) List

func (s *SimpleEtcd) List(directory string) ([]*store.KVPair, error)

I'd like to get away with serializable here. We typically write to the same store that we're reading from. If this becomes a problem we can remove the WithSerializable()

func (*SimpleEtcd) Put

func (s *SimpleEtcd) Put(key string, value []byte, opts *store.WriteOptions) error

func (*SimpleEtcd) PutNoTimeout

func (s *SimpleEtcd) PutNoTimeout(key string, value []byte, opts *store.WriteOptions) error

We have one call in server.go that will block until we can write to an etcd cluster so we'll call putHelper with a background context.

type Storer

type Storer interface {
	Put(key string, value []byte, options *store.WriteOptions) error

	// Get a value given its key
	Get(key string) (*store.KVPair, error)

	// Delete the value at the specified key
	Delete(key string) error

	// Verify if a Key exists in the store
	Exists(key string) (bool, error)

	// List the content of a given prefix
	List(directory string) ([]*store.KVPair, error)

	// Atomic CAS operation on a single value.
	// Pass previous = nil to create a new key.
	AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)
}

Jump to

Keyboard shortcuts

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