vault: github.com/hashicorp/vault/physical/etcd Index | Files

package etcd

import "github.com/hashicorp/vault/physical/etcd"

Index

Package Files

etcd.go etcd2.go etcd3.go

Constants

const (
    // Ideally, this prefix would match the "_" used in the file backend, but
    // that prefix has special meaning 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 directory 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 acquisition")
    EtcdVersionUnknown           = errors.New("etcd: unknown API version")
)

func NewEtcdBackend Uses

func NewEtcdBackend(conf map[string]string, logger log.Logger) (physical.Backend, error)

NewEtcdBackend constructs a etcd backend using a given machine address.

type Etcd2Backend Uses

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 Uses

func (c *Etcd2Backend) Delete(ctx context.Context, key string) error

Delete is used to permanently delete an entry.

func (*Etcd2Backend) Get Uses

func (c *Etcd2Backend) Get(ctx context.Context, key string) (*physical.Entry, error)

Get is used to fetch an entry.

func (*Etcd2Backend) HAEnabled Uses

func (e *Etcd2Backend) HAEnabled() bool

HAEnabled indicates whether the HA functionality should be exposed. Currently always returns true.

func (*Etcd2Backend) List Uses

func (c *Etcd2Backend) List(ctx context.Context, prefix string) ([]string, error)

List is used to list all the keys under a given prefix, up to the next prefix.

func (*Etcd2Backend) LockWith Uses

func (c *Etcd2Backend) LockWith(key, value string) (physical.Lock, error)

Lock is used for mutual exclusion based on the given key.

func (*Etcd2Backend) Put Uses

func (c *Etcd2Backend) Put(ctx context.Context, entry *physical.Entry) error

Put is used to insert or update an entry.

type Etcd2Lock Uses

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

Etcd2Lock implements a lock using and Etcd2 backend.

func (*Etcd2Lock) Lock Uses

func (c *Etcd2Lock) Lock(stopCh <-chan struct{}) (doneCh <-chan struct{}, retErr error)

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.

func (*Etcd2Lock) Unlock Uses

func (c *Etcd2Lock) Unlock() error

Unlock releases the lock by deleting the associated semaphore key in etcd.

If the lock is not currently held by this instance of Etcd2Lock, Unlock will return an Etcd2LockNotHeldError error.

func (*Etcd2Lock) Value Uses

func (c *Etcd2Lock) Value() (bool, string, error)

Value checks whether or not the lock is held by any instance of Etcd2Lock, including this one, and returns the current value.

type EtcdBackend Uses

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 Uses

func (c *EtcdBackend) Delete(ctx context.Context, key string) error

func (*EtcdBackend) Get Uses

func (c *EtcdBackend) Get(ctx context.Context, key string) (*physical.Entry, error)

func (*EtcdBackend) HAEnabled Uses

func (e *EtcdBackend) HAEnabled() bool

func (*EtcdBackend) List Uses

func (c *EtcdBackend) List(ctx context.Context, prefix string) ([]string, error)

func (*EtcdBackend) LockWith Uses

func (c *EtcdBackend) LockWith(key, value string) (physical.Lock, error)

Lock is used for mutual exclusion based on the given key.

func (*EtcdBackend) Put Uses

func (c *EtcdBackend) Put(ctx context.Context, entry *physical.Entry) error

type EtcdLock Uses

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

EtcdLock implements a lock using and etcd backend.

func (*EtcdLock) Lock Uses

func (c *EtcdLock) Lock(stopCh <-chan struct{}) (<-chan struct{}, error)

func (*EtcdLock) Unlock Uses

func (c *EtcdLock) Unlock() error

func (*EtcdLock) Value Uses

func (c *EtcdLock) Value() (bool, string, error)

Package etcd imports 24 packages (graph) and is imported by 3 packages. Updated 2019-05-14. Refresh now. Tools for package owners.