cachememdb

package
v1.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IndexNameID is the ID of the index constructed from the serialized request.
	IndexNameID = "id"

	// IndexNameLease is the lease of the index.
	IndexNameLease = "lease"

	// IndexNameRequestPath is the request path of the index.
	IndexNameRequestPath = "request_path"

	// IndexNameToken is the token of the index.
	IndexNameToken = "token"

	// IndexNameTokenAccessor is the token accessor of the index.
	IndexNameTokenAccessor = "token_accessor"

	// IndexNameTokenParent is the token parent of the index.
	IndexNameTokenParent = "token_parent"

	// IndexNameLeaseToken is the token that created the lease.
	IndexNameLeaseToken = "lease_token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheMemDB

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

CacheMemDB is the underlying cache database for storing indexes.

func New

func New() (*CacheMemDB, error)

New creates a new instance of CacheMemDB.

func (*CacheMemDB) Evict

func (c *CacheMemDB) Evict(indexName string, indexValues ...interface{}) error

Evict removes an index from the cache based on index name and value.

func (*CacheMemDB) Flush

func (c *CacheMemDB) Flush() error

Flush resets the underlying cache object.

func (*CacheMemDB) Get

func (c *CacheMemDB) Get(indexName string, indexValues ...interface{}) (*Index, error)

Get returns the index based on the indexer and the index values provided.

func (*CacheMemDB) GetByPrefix

func (c *CacheMemDB) GetByPrefix(indexName string, indexValues ...interface{}) ([]*Index, error)

GetByPrefix returns all the cached indexes based on the index name and the value prefix.

func (*CacheMemDB) Set

func (c *CacheMemDB) Set(index *Index) error

Set stores the index into the cache.

type ContextInfo

type ContextInfo struct {
	Ctx        context.Context
	CancelFunc context.CancelFunc
	DoneCh     chan struct{}
}

func NewContextInfo

func NewContextInfo(ctx context.Context) *ContextInfo

type Index

type Index struct {
	// ID is a value that uniquely represents the request held by this
	// index. This is computed by serializing and hashing the response object.
	// Required: true, Unique: true
	ID string

	// Token is the token that fetched the response held by this index
	// Required: true, Unique: true
	Token string

	// TokenParent is the parent token of the token held by this index
	// Required: false, Unique: false
	TokenParent string

	// TokenAccessor is the accessor of the token being cached in this index
	// Required: true, Unique: true
	TokenAccessor string

	// Namespace is the namespace that was provided in the request path as the
	// Vault namespace to query
	Namespace string

	// RequestPath is the path of the request that resulted in the response
	// held by this index.
	// Required: true, Unique: false
	RequestPath string

	// Lease is the identifier of the lease in Vault, that belongs to the
	// response held by this index.
	// Required: false, Unique: true
	Lease string

	// LeaseToken is the identifier of the token that created the lease held by
	// this index.
	// Required: false, Unique: false
	LeaseToken string

	// Response is the serialized response object that the agent is caching.
	Response []byte

	// RenewCtxInfo holds the context and the corresponding cancel func for the
	// goroutine that manages the renewal of the secret belonging to the
	// response in this index.
	RenewCtxInfo *ContextInfo
}

Index holds the response to be cached along with multiple other values that serve as pointers to refer back to this index.

type IndexName

type IndexName uint32

Jump to

Keyboard shortcuts

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