Documentation ¶
Overview ¶
Package physical is a generated protocol buffer package.
It is generated from these files:
types.proto
It has these top-level messages:
SealWrapEntry
Index ¶
- Constants
- Variables
- func ExerciseBackend(t *testing.T, b Backend)
- func ExerciseBackend_ListPrefix(t *testing.T, b Backend)
- func ExerciseHABackend(t *testing.T, b HABackend, b2 HABackend)
- func ExerciseTransactionalBackend(t *testing.T, b Backend)
- func GenericTransactionHandler(t PseudoTransactional, txns []*TxnEntry) (retErr error)
- func Prefixes(s string) []string
- type ActiveFunction
- type Backend
- type Cache
- type Entry
- type Factory
- type HABackend
- type LatencyInjector
- type Lock
- type Operation
- type PermitPool
- type PhysicalAccess
- type PseudoTransactional
- type Purgable
- type RedirectDetect
- type SealWrapEntry
- func (*SealWrapEntry) Descriptor() ([]byte, []int)
- func (m *SealWrapEntry) GetCiphertext() []byte
- func (m *SealWrapEntry) GetHMAC() []byte
- func (m *SealWrapEntry) GetIV() []byte
- func (m *SealWrapEntry) GetWrapped() bool
- func (*SealWrapEntry) ProtoMessage()
- func (m *SealWrapEntry) Reset()
- func (m *SealWrapEntry) String() string
- type SealedFunction
- type ServiceDiscovery
- type ShutdownChannel
- type Transactional
- type TransactionalCache
- type TransactionalLatencyInjector
- type TxnEntry
- type View
Constants ¶
const ( DeleteOperation Operation = "delete" GetOperation = "get" ListOperation = "list" PutOperation = "put" )
const (
// DefaultCacheSize is used if no cache size is specified for NewCache
DefaultCacheSize = 32 * 1024
)
const (
// DefaultJitterPercent is used if no cache size is specified for NewCache
DefaultJitterPercent = 20
)
const DefaultParallelOperations = 128
Variables ¶
var (
ErrRelativePath = errors.New("relative paths not supported")
)
Functions ¶
func ExerciseBackend ¶ added in v0.8.0
func ExerciseBackend_ListPrefix ¶ added in v0.8.0
func ExerciseHABackend ¶ added in v0.8.0
func ExerciseTransactionalBackend ¶ added in v0.8.0
func GenericTransactionHandler ¶ added in v0.8.0
func GenericTransactionHandler(t PseudoTransactional, txns []*TxnEntry) (retErr error)
Implements the transaction interface
Types ¶
type ActiveFunction ¶ added in v0.8.0
type ActiveFunction func() bool
Callback signatures for RunServiceDiscovery
type Backend ¶
type Backend interface { // Put is used to insert or update an entry Put(entry *Entry) error // Get is used to fetch an entry Get(key string) (*Entry, error) // Delete is used to permanently delete an entry Delete(key string) error // List is used ot list all the keys under a given // prefix, up to the next prefix. List(prefix string) ([]string, error) }
Backend is the interface required for a physical backend. A physical backend is used to durably store data outside of Vault. As such, it is completely untrusted, and is only accessed via a security barrier. The backends must represent keys in a hierarchical manner. All methods are expected to be thread safe.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is used to wrap an underlying physical backend and provide an LRU cache layer on top. Most of the reads done by Vault are for policy objects so there is a large read reduction by using a simple write-through cache.
type HABackend ¶
type HABackend interface { // LockWith is used for mutual exclusion based on the given key. LockWith(key, value string) (Lock, error) // Whether or not HA functionality is enabled HAEnabled() bool }
HABackend is an extensions to the standard physical backend to support high-availability. Vault only expects to use mutual exclusion to allow multiple instances to act as a hot standby for a leader that services all requests.
type LatencyInjector ¶ added in v0.8.3
type LatencyInjector struct {
// contains filtered or unexported fields
}
LatencyInjector is used to add latency into underlying physical requests
func NewLatencyInjector ¶ added in v0.8.3
func NewLatencyInjector(b Backend, latency time.Duration, jitter int, logger log.Logger) *LatencyInjector
NewLatencyInjector returns a wrapped physical backend to simulate latency
func (*LatencyInjector) Delete ¶ added in v0.8.3
func (l *LatencyInjector) Delete(key string) error
Delete is a latent delete request
func (*LatencyInjector) Get ¶ added in v0.8.3
func (l *LatencyInjector) Get(key string) (*Entry, error)
Get is a latent get request
func (*LatencyInjector) List ¶ added in v0.8.3
func (l *LatencyInjector) List(prefix string) ([]string, error)
List is a latent list request
func (*LatencyInjector) Put ¶ added in v0.8.3
func (l *LatencyInjector) Put(entry *Entry) error
Put is a latent put request
type Lock ¶
type Lock interface { // Lock is used to acquire the given lock // The stopCh is optional and if closed should interrupt the lock // acquisition attempt. The return struct should be closed when // leadership is lost. Lock(stopCh <-chan struct{}) (<-chan struct{}, error) // Unlock is used to release the lock Unlock() error // Returns the value of the lock and if it is held Value() (bool, string, error) }
type PermitPool ¶ added in v0.4.0
type PermitPool struct {
// contains filtered or unexported fields
}
PermitPool is used to limit maximum outstanding requests
func NewPermitPool ¶ added in v0.4.0
func NewPermitPool(permits int) *PermitPool
NewPermitPool returns a new permit pool with the provided number of permits
func (*PermitPool) Acquire ¶ added in v0.4.0
func (c *PermitPool) Acquire()
Acquire returns when a permit has been acquired
func (*PermitPool) Release ¶ added in v0.4.0
func (c *PermitPool) Release()
Release returns a permit to the pool
type PhysicalAccess ¶ added in v0.9.0
type PhysicalAccess struct {
// contains filtered or unexported fields
}
PhysicalAccess is a wrapper around physical.Backend that allows Core to expose its physical storage operations through PhysicalAccess() while restricting the ability to modify Core.physical itself.
func NewPhysicalAccess ¶ added in v0.9.0
func NewPhysicalAccess(physical Backend) *PhysicalAccess
func (*PhysicalAccess) Delete ¶ added in v0.9.0
func (p *PhysicalAccess) Delete(key string) error
func (*PhysicalAccess) Get ¶ added in v0.9.0
func (p *PhysicalAccess) Get(key string) (*Entry, error)
func (*PhysicalAccess) List ¶ added in v0.9.0
func (p *PhysicalAccess) List(prefix string) ([]string, error)
func (*PhysicalAccess) Purge ¶ added in v0.9.0
func (p *PhysicalAccess) Purge()
func (*PhysicalAccess) Put ¶ added in v0.9.0
func (p *PhysicalAccess) Put(entry *Entry) error
type PseudoTransactional ¶ added in v0.7.0
type PseudoTransactional interface { // An internal function should do no locking or permit pool acquisition. // Depending on the backend and if it natively supports transactions, these // may simply chain to the normal backend functions. GetInternal(string) (*Entry, error) PutInternal(*Entry) error DeleteInternal(string) error }
type Purgable ¶ added in v0.6.5
type Purgable interface {
Purge()
}
Purgable is an optional interface for backends that support purging of their caches.
type RedirectDetect ¶ added in v0.6.1
type RedirectDetect interface { // DetectHostAddr is used to detect the host address DetectHostAddr() (string, error) }
RedirectDetect is an optional interface that an HABackend can implement. If they do, a redirect address can be automatically detected.
type SealWrapEntry ¶ added in v0.9.1
type SealWrapEntry struct { Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` IV []byte `protobuf:"bytes,2,opt,name=iv,proto3" json:"iv,omitempty"` HMAC []byte `protobuf:"bytes,3,opt,name=hmac,proto3" json:"hmac,omitempty"` Wrapped bool `protobuf:"varint,4,opt,name=wrapped" json:"wrapped,omitempty"` }
func (*SealWrapEntry) Descriptor ¶ added in v0.9.1
func (*SealWrapEntry) Descriptor() ([]byte, []int)
func (*SealWrapEntry) GetCiphertext ¶ added in v0.9.1
func (m *SealWrapEntry) GetCiphertext() []byte
func (*SealWrapEntry) GetHMAC ¶ added in v0.9.1
func (m *SealWrapEntry) GetHMAC() []byte
func (*SealWrapEntry) GetIV ¶ added in v0.9.1
func (m *SealWrapEntry) GetIV() []byte
func (*SealWrapEntry) GetWrapped ¶ added in v0.9.1
func (m *SealWrapEntry) GetWrapped() bool
func (*SealWrapEntry) ProtoMessage ¶ added in v0.9.1
func (*SealWrapEntry) ProtoMessage()
func (*SealWrapEntry) Reset ¶ added in v0.9.1
func (m *SealWrapEntry) Reset()
func (*SealWrapEntry) String ¶ added in v0.9.1
func (m *SealWrapEntry) String() string
type SealedFunction ¶ added in v0.8.0
type SealedFunction func() bool
type ServiceDiscovery ¶ added in v0.6.0
type ServiceDiscovery interface { // NotifyActiveStateChange is used by Core to notify a backend // capable of ServiceDiscovery that this Vault instance has changed // its status to active or standby. NotifyActiveStateChange() error // NotifySealedStateChange is used by Core to notify a backend // capable of ServiceDiscovery that Vault has changed its Sealed // status to sealed or unsealed. NotifySealedStateChange() error // Run executes any background service discovery tasks until the // shutdown channel is closed. RunServiceDiscovery(waitGroup *sync.WaitGroup, shutdownCh ShutdownChannel, redirectAddr string, activeFunc ActiveFunction, sealedFunc SealedFunction) error }
ServiceDiscovery is an optional interface that an HABackend can implement. If they do, the state of a backend is advertised to the service discovery network.
type Transactional ¶ added in v0.7.0
type Transactional interface { // The function to run a transaction Transaction([]*TxnEntry) error }
Transactional is an optional interface for backends that support doing transactional updates of multiple keys. This is required for some features such as replication.
type TransactionalCache ¶ added in v0.8.0
type TransactionalCache struct { *Cache Transactional }
TransactionalCache is a Cache that wraps the physical that is transactional
func NewTransactionalCache ¶ added in v0.8.0
func (*TransactionalCache) Transaction ¶ added in v0.8.0
func (c *TransactionalCache) Transaction(txns []*TxnEntry) error
type TransactionalLatencyInjector ¶ added in v0.8.3
type TransactionalLatencyInjector struct { *LatencyInjector Transactional }
TransactionalLatencyInjector is the transactional version of the latency injector
func NewTransactionalLatencyInjector ¶ added in v0.8.3
func NewTransactionalLatencyInjector(b Backend, latency time.Duration, jitter int, logger log.Logger) *TransactionalLatencyInjector
NewTransactionalLatencyInjector creates a new transactional LatencyInjector
func (*TransactionalLatencyInjector) Transaction ¶ added in v0.8.3
func (l *TransactionalLatencyInjector) Transaction(txns []*TxnEntry) error
Transaction is a latent transaction request
type TxnEntry ¶ added in v0.7.0
TxnEntry is an operation that takes atomically as part of a transactional update. Only supported by Transactional backends.
type View ¶ added in v0.8.0
type View struct {
// contains filtered or unexported fields
}
View represents a prefixed view of a physical backend
func NewView ¶ added in v0.8.0
NewView takes an underlying physical backend and returns a view of it that can only operate with the given prefix.