Documentation ¶
Index ¶
- Constants
- Variables
- func NewEtcdBackend(conf map[string]string, logger log.Logger) (physical.Backend, error)
- type Etcd2Backend
- func (c *Etcd2Backend) Delete(key string) error
- func (c *Etcd2Backend) Get(key string) (*physical.Entry, error)
- func (e *Etcd2Backend) HAEnabled() bool
- func (c *Etcd2Backend) List(prefix string) ([]string, error)
- func (c *Etcd2Backend) LockWith(key, value string) (physical.Lock, error)
- func (c *Etcd2Backend) Put(entry *physical.Entry) error
- type Etcd2Lock
- type EtcdBackend
- func (c *EtcdBackend) Delete(key string) error
- func (c *EtcdBackend) Get(key string) (*physical.Entry, error)
- func (e *EtcdBackend) HAEnabled() bool
- func (c *EtcdBackend) List(prefix string) ([]string, error)
- func (c *EtcdBackend) LockWith(key, value string) (physical.Lock, error)
- func (c *EtcdBackend) Put(entry *physical.Entry) error
- type EtcdLock
Constants ¶
const ( // Ideally, this prefix would match the "_" used in the file backend, but // that prefix has special meaining in etcd. Specifically, it excludes those // entries from directory listings. Etcd2NodeFilePrefix = "." // The lock prefix can (and probably should) cause an entry to be excluded // from diretory listings, so "_" works here. Etcd2NodeLockPrefix = "_" // The delimiter is the same as the `-C` flag of etcdctl. Etcd2MachineDelimiter = "," // The lock TTL matches the default that Consul API uses, 15 seconds. Etcd2LockTTL = 15 * time.Second // The amount of time to wait between the semaphore key renewals Etcd2LockRenewInterval = 5 * time.Second // The amount of time to wait if a watch fails before trying again. Etcd2WatchRetryInterval = time.Second // The number of times to re-try a failed watch before signaling that leadership is lost. Etcd2WatchRetryMax = 5 )
Variables ¶
var ( EtcdSyncConfigError = errors.New("client setup failed: unable to parse etcd sync field in config") EtcdSyncClusterError = errors.New("client setup failed: unable to sync etcd cluster") EtcdMultipleBootstrapError = errors.New("client setup failed: multiple discovery or bootstrap flags specified, use either \"address\" or \"discovery_srv\"") EtcdAddressError = errors.New("client setup failed: address must be valid URL (ex. 'scheme://host:port')") EtcdSemaphoreKeysEmptyError = errors.New("lock queue is empty") EtcdLockHeldError = errors.New("lock already held") EtcdLockNotHeldError = errors.New("lock not held") EtcdSemaphoreKeyRemovedError = errors.New("semaphore key removed before lock aquisition") EtcdVersionUnknown = errors.New("etcd: unknown API version") )
Functions ¶
Types ¶
type Etcd2Backend ¶
type Etcd2Backend struct {
// contains filtered or unexported fields
}
Etcd2Backend is a physical backend that stores data at specific prefix within etcd. It is used for most production situations as it allows Vault to run on multiple machines in a highly-available manner.
func (*Etcd2Backend) Delete ¶
func (c *Etcd2Backend) Delete(key string) error
Delete is used to permanently delete an entry.
func (*Etcd2Backend) Get ¶
func (c *Etcd2Backend) Get(key string) (*physical.Entry, error)
Get is used to fetch an entry.
func (*Etcd2Backend) HAEnabled ¶
func (e *Etcd2Backend) HAEnabled() bool
HAEnabled indicates whether the HA functionality should be exposed. Currently always returns true.
func (*Etcd2Backend) List ¶
func (c *Etcd2Backend) List(prefix string) ([]string, error)
List is used to list all the keys under a given prefix, up to the next prefix.
type Etcd2Lock ¶
type Etcd2Lock struct {
// contains filtered or unexported fields
}
Etcd2Lock emplements a lock using and Etcd2 backend.
func (*Etcd2Lock) Lock ¶
Lock attempts to acquire the lock by waiting for a new semaphore key in etcd to become the first in the queue and will block until it is successful or it receives a signal on the provided channel. The returned channel will be closed when the lock is lost, either by an explicit call to Unlock or by the associated semaphore key in etcd otherwise being deleted or expiring.
If the lock is currently held by this instance of Etcd2Lock, Lock will return an Etcd2LockHeldError error.
type EtcdBackend ¶
type EtcdBackend struct {
// contains filtered or unexported fields
}
EtcdBackend is a physical backend that stores data at specific prefix within etcd. It is used for most production situations as it allows Vault to run on multiple machines in a highly-available manner.
func (*EtcdBackend) Delete ¶
func (c *EtcdBackend) Delete(key string) error
func (*EtcdBackend) HAEnabled ¶
func (e *EtcdBackend) HAEnabled() bool