Help us shape the future of Go! Take the 2026 Go Developer Survey

cacheboltdb

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DatabaseFileName - filename for the persistent cache file
	DatabaseFileName = "vault-agent-cache.db"

	// SecretLeaseType - Bucket/type for leases with secret info
	SecretLeaseType = "secret-lease"

	// AuthLeaseType - Bucket/type for leases with auth info
	AuthLeaseType = "auth-lease"

	// TokenType - Bucket/type for auto-auth tokens
	TokenType = "token"

	// AutoAuthToken - key for the latest auto-auth token
	AutoAuthToken = "auto-auth-token"

	// RetrievalTokenMaterial is the actual key or token in the key bucket
	RetrievalTokenMaterial = "retrieval-token-material"
)

Variables

This section is empty.

Functions

func DBFileExists

func DBFileExists(path string) (bool, error)

DBFileExists checks whether the vault agent cache file at `filePath` exists

Types

type BoltStorage

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

BoltStorage is a persistent cache using a bolt db. Items are organized with the version and bootstrapping items in the "meta" bucket, and tokens, auth leases, and secret leases in their own buckets.

func NewBoltStorage

func NewBoltStorage(config *BoltStorageConfig) (*BoltStorage, error)

NewBoltStorage opens a new bolt db at the specified file path and returns it. If the db already exists the buckets will just be created if they don't exist.

func (*BoltStorage) Clear

func (b *BoltStorage) Clear() error

Clear the boltdb by deleting all the token and lease buckets and recreating the schema/layout

func (*BoltStorage) Close

func (b *BoltStorage) Close() error

Close the boltdb

func (*BoltStorage) Delete

func (b *BoltStorage) Delete(id string) error

Delete an index (token or lease) by id from bolt storage

func (*BoltStorage) GetAutoAuthToken

func (b *BoltStorage) GetAutoAuthToken(ctx context.Context) ([]byte, error)

GetAutoAuthToken retrieves the latest auto-auth token, and returns nil if non exists yet

func (*BoltStorage) GetByType

func (b *BoltStorage) GetByType(ctx context.Context, indexType string) ([][]byte, error)

GetByType returns a list of stored items of the specified type

func (*BoltStorage) GetRetrievalToken

func (b *BoltStorage) GetRetrievalToken() ([]byte, error)

GetRetrievalToken retrieves a plaintext token from the KeyBucket, which will be used by the key manager to retrieve the encryption key, nil if none set

func (*BoltStorage) Set

func (b *BoltStorage) Set(ctx context.Context, id string, plaintext []byte, indexType string) error

Set an index (token or lease) in bolt storage

func (*BoltStorage) StoreRetrievalToken

func (b *BoltStorage) StoreRetrievalToken(token []byte) error

StoreRetrievalToken sets plaintext token material in the RetrievalTokenBucket

type BoltStorageConfig

type BoltStorageConfig struct {
	Path    string
	Logger  hclog.Logger
	Wrapper wrapping.Wrapper
	AAD     string
}

BoltStorageConfig is the collection of input parameters for setting up bolt storage

Jump to

Keyboard shortcuts

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