Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPutLimitExceeded = errors.New("Put limit exceeded.")
Functions ¶
This section is empty.
Types ¶
type SerializableUsageSet ¶
type SerializableUsageSet map[[32]byte]memEntry
func UsageSet ¶
func UsageSet(source []byte) (SerializableUsageSet, error)
func (SerializableUsageSet) Cleanup ¶
func (s SerializableUsageSet) Cleanup()
func (SerializableUsageSet) Get ¶
func (s SerializableUsageSet) Get(key string) (memEntry, bool)
func (SerializableUsageSet) Serialize ¶
func (s SerializableUsageSet) Serialize() []byte
Format: Header (1 byte) Size (n) (4 bytes) n memEntrys
key 32 bytes usage 4 bytes created 15 bytes expires 15 bytes max 4 bytes
func (SerializableUsageSet) Set ¶
func (s SerializableUsageSet) Set(key string, value memEntry)
type UsageStore ¶
type UsageStore interface {
// Should return true if the store has information about this process.
Has(string, string) (bool, error)
// Log information about the issue of a token and how long the store should
// remember this information. Acquire should only succeed if the usage count
// is less than the max provided. The duration should be longer than the
// time window for valid token requests. Ex. if the configuration dictates
// that Gatekeeper will only issue tokens to tasks in the first 2 minutes
// of their lifetime, then this paramter should be 2m30s.
// Acquire should panic if max is less than 1.
Acquire(string, string, int, time.Duration) error
// How many times a process requested a token.
UsageCount(string, string) (int, error)
// Destroy this usage store, close any connectinos and release any
// resources.
Destroy() error
}
UsageStore stores the state about the tokens that Gatekeeper has issued and how many times a certain process has requested a key. UsageStore implementations are expected to support access by multiple goroutines.
func NewInMemoryUsageStore ¶
func NewInMemoryUsageStore() (UsageStore, error)
NewInMemoryUsageStore creates a usage store backed by memory. This usage store is only appropriate for single instance gatekeeper deployments and should not be used for high availablility deployments.
func NewVaultStore ¶
func NewVaultStore(path string) (UsageStore, error)
type VaultTokenGetter ¶
type VaultTokenGetter interface {
VaultToken() string
}
Click to show internal directories.
Click to hide internal directories.