Documentation ¶
Index ¶
- Variables
- type EtcdServer
- type SimpleEtcd
- func (s *SimpleEtcd) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error)
- func (s *SimpleEtcd) Client() *clientv3.Client
- func (s *SimpleEtcd) Delete(key string) error
- func (s *SimpleEtcd) DeleteTree(keyPrefix string) error
- func (s *SimpleEtcd) Exists(key string) (bool, error)
- func (s *SimpleEtcd) External() bool
- func (s *SimpleEtcd) Get(key string) (pair *store.KVPair, err error)
- func (s *SimpleEtcd) List(directory string) ([]*store.KVPair, error)
- func (s *SimpleEtcd) Put(key string, value []byte, opts *store.WriteOptions) error
- func (s *SimpleEtcd) PutNoTimeout(key string, value []byte, opts *store.WriteOptions) error
- type Storer
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 }
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) 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) 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) }
Click to show internal directories.
Click to hide internal directories.