Documentation
¶
Index ¶
- func ShouldInvalidate(last *metav1.Time, now time.Time, interval time.Duration) bool
- type CompiledRule
- type CompiledTarget
- type CompiledTargetsCache
- func (c *CompiledTargetsCache[K]) Delete(key K) bool
- func (c *CompiledTargetsCache[K]) Get(key K) ([]CompiledTarget, bool)
- func (c *CompiledTargetsCache[K]) GetOrBuild(key K, build func() ([]CompiledTarget, error)) ([]CompiledTarget, error)
- func (c *CompiledTargetsCache[K]) PruneActive(active map[K]struct{}) int
- func (c *CompiledTargetsCache[K]) Reset()
- func (c *CompiledTargetsCache[K]) Set(key K, value []CompiledTarget)
- func (c *CompiledTargetsCache[K]) Stats() int
- type DiscoveryNamespacedResourceCache
- type ImpersonationCache
- func (c *ImpersonationCache) Get(ns, name string) (client.Client, bool)
- func (c *ImpersonationCache) Invalidate(namespace, name string)
- func (c *ImpersonationCache) LoadOrCreate(ctx context.Context, log logr.Logger, baseREST *rest.Config, ...) (client.Client, error)
- func (c *ImpersonationCache) Reset()
- func (c *ImpersonationCache) Set(namespace, name string, cl client.Client)
- func (c *ImpersonationCache) Stats() (entries int)
- type JSONPathCache
- func (c *JSONPathCache) Delete(path string) bool
- func (c *JSONPathCache) DeleteMany(expressions ...string) int
- func (c *JSONPathCache) Get(path string) (*jsonpath.CompiledJSONPath, bool)
- func (c *JSONPathCache) GetOrCompile(path string) (*jsonpath.CompiledJSONPath, error)
- func (c *JSONPathCache) PruneActive(active map[string]struct{}) int
- func (c *JSONPathCache) Reset()
- func (c *JSONPathCache) Stats() int
- type Key
- type PendingDeleteHint
- type QuantityCache
- func (c *QuantityCache[K]) AddPendingDelete(key K, uid types.UID)
- func (c *QuantityCache[K]) Delete(key K) bool
- func (c *QuantityCache[K]) DeleteReservation(key K, reservationID string) bool
- func (c *QuantityCache[K]) Get(key K) (QuantityEntry, bool)
- func (c *QuantityCache[K]) HasPendingDeletes(key K) bool
- func (c *QuantityCache[K]) Len() int
- func (c *QuantityCache[K]) PendingDeletes(key K) []types.UID
- func (c *QuantityCache[K]) PurgeReservationsForKey(key K, shouldDelete func(Reservation) bool) int
- func (c *QuantityCache[K]) RemovePendingDelete(key K, uid types.UID) bool
- func (c *QuantityCache[K]) Snapshot() map[K]QuantityEntry
- func (c *QuantityCache[K]) UpsertReservation(key K, reservation Reservation, persistedUsed resource.Quantity, ...) (allowed bool, effectiveUsed resource.Quantity, entry QuantityEntry)
- type QuantityEntry
- type RegistryRuleSetCache
- func (c *RegistryRuleSetCache) GetOrBuild(specRules []api.OCIRegistry) (rs *RuleSet, fromCache bool, err error)
- func (c *RegistryRuleSetCache) Has(id string) bool
- func (c *RegistryRuleSetCache) HashRules(specRules []api.OCIRegistry) string
- func (c *RegistryRuleSetCache) PruneActive(activeIDs map[string]struct{}) int
- func (c *RegistryRuleSetCache) Reset()
- func (c *RegistryRuleSetCache) Stats() int
- type Reservation
- type RuleSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompiledRule ¶
type CompiledTarget ¶
type CompiledTarget struct {
capsulev1beta2.CustomQuotaStatusTarget
CompiledPath *jsonpath.CompiledJSONPath
CompiledSelectors []selectors.CompiledSelectorWithFields
CompiledConditions []*jsonpath.CompiledJSONPath
}
type CompiledTargetsCache ¶
type CompiledTargetsCache[K comparable] struct { // contains filtered or unexported fields }
func NewCompiledTargetsCache ¶
func NewCompiledTargetsCache[K comparable]() *CompiledTargetsCache[K]
func (*CompiledTargetsCache[K]) Delete ¶
func (c *CompiledTargetsCache[K]) Delete(key K) bool
func (*CompiledTargetsCache[K]) Get ¶
func (c *CompiledTargetsCache[K]) Get(key K) ([]CompiledTarget, bool)
func (*CompiledTargetsCache[K]) GetOrBuild ¶
func (c *CompiledTargetsCache[K]) GetOrBuild(key K, build func() ([]CompiledTarget, error)) ([]CompiledTarget, error)
func (*CompiledTargetsCache[K]) PruneActive ¶
func (c *CompiledTargetsCache[K]) PruneActive(active map[K]struct{}) int
func (*CompiledTargetsCache[K]) Reset ¶
func (c *CompiledTargetsCache[K]) Reset()
func (*CompiledTargetsCache[K]) Set ¶
func (c *CompiledTargetsCache[K]) Set(key K, value []CompiledTarget)
func (*CompiledTargetsCache[K]) Stats ¶
func (c *CompiledTargetsCache[K]) Stats() int
type DiscoveryNamespacedResourceCache ¶
type DiscoveryNamespacedResourceCache struct {
// contains filtered or unexported fields
}
func NewDiscoveryNamespacedResourceCache ¶
func NewDiscoveryNamespacedResourceCache() DiscoveryNamespacedResourceCache
func NewDiscoveryNamespacedResourceCacheWithTTL ¶
func NewDiscoveryNamespacedResourceCacheWithTTL(ttl time.Duration) DiscoveryNamespacedResourceCache
func (*DiscoveryNamespacedResourceCache) Get ¶
func (c *DiscoveryNamespacedResourceCache) Get( disco discovery.DiscoveryInterface, ) ([]schema.GroupVersionResource, error)
func (*DiscoveryNamespacedResourceCache) Invalidate ¶
func (c *DiscoveryNamespacedResourceCache) Invalidate()
type ImpersonationCache ¶
type ImpersonationCache struct {
// contains filtered or unexported fields
}
func NewImpersonationCache ¶
func NewImpersonationCache() *ImpersonationCache
func (*ImpersonationCache) Get ¶
func (c *ImpersonationCache) Get(ns, name string) (client.Client, bool)
Get returns a cached client if present.
func (*ImpersonationCache) Invalidate ¶
func (c *ImpersonationCache) Invalidate(namespace, name string)
Invalidate removes one entry.
func (*ImpersonationCache) LoadOrCreate ¶
func (c *ImpersonationCache) LoadOrCreate( ctx context.Context, log logr.Logger, baseREST *rest.Config, scheme *runtime.Scheme, sa meta.NamespacedRFC1123ObjectReferenceWithNamespace, ) (client.Client, error)
LoadOrCreate returns a cached impersonated client for the given service account, creating and caching it if missing.
func (*ImpersonationCache) Reset ¶
func (c *ImpersonationCache) Reset()
Clear drops all cached clients.
func (*ImpersonationCache) Set ¶
func (c *ImpersonationCache) Set(namespace, name string, cl client.Client)
Set stores a client explicitly (rarely needed).
func (*ImpersonationCache) Stats ¶
func (c *ImpersonationCache) Stats() (entries int)
Stats helps you log cache state.
type JSONPathCache ¶
type JSONPathCache struct {
// contains filtered or unexported fields
}
func NewJSONPathCache ¶
func NewJSONPathCache() *JSONPathCache
func (*JSONPathCache) Delete ¶
func (c *JSONPathCache) Delete(path string) bool
func (*JSONPathCache) DeleteMany ¶
func (c *JSONPathCache) DeleteMany(expressions ...string) int
func (*JSONPathCache) Get ¶
func (c *JSONPathCache) Get(path string) (*jsonpath.CompiledJSONPath, bool)
func (*JSONPathCache) GetOrCompile ¶
func (c *JSONPathCache) GetOrCompile(path string) (*jsonpath.CompiledJSONPath, error)
func (*JSONPathCache) PruneActive ¶
func (c *JSONPathCache) PruneActive(active map[string]struct{}) int
func (*JSONPathCache) Reset ¶
func (c *JSONPathCache) Reset()
func (*JSONPathCache) Stats ¶
func (c *JSONPathCache) Stats() int
type QuantityCache ¶
type QuantityCache[K comparable] struct { // contains filtered or unexported fields }
func NewQuantityCache ¶
func NewQuantityCache[K comparable]() *QuantityCache[K]
func (*QuantityCache[K]) AddPendingDelete ¶
func (c *QuantityCache[K]) AddPendingDelete(key K, uid types.UID)
func (*QuantityCache[K]) Delete ¶
func (c *QuantityCache[K]) Delete(key K) bool
func (*QuantityCache[K]) DeleteReservation ¶
func (c *QuantityCache[K]) DeleteReservation(key K, reservationID string) bool
func (*QuantityCache[K]) Get ¶
func (c *QuantityCache[K]) Get(key K) (QuantityEntry, bool)
func (*QuantityCache[K]) HasPendingDeletes ¶
func (c *QuantityCache[K]) HasPendingDeletes(key K) bool
func (*QuantityCache[K]) Len ¶
func (c *QuantityCache[K]) Len() int
func (*QuantityCache[K]) PendingDeletes ¶
func (c *QuantityCache[K]) PendingDeletes(key K) []types.UID
func (*QuantityCache[K]) PurgeReservationsForKey ¶
func (c *QuantityCache[K]) PurgeReservationsForKey( key K, shouldDelete func(Reservation) bool, ) int
PurgeReservationsForKey removes reservations for which shouldDelete returns true. Returns number of removed reservations.
func (*QuantityCache[K]) RemovePendingDelete ¶
func (c *QuantityCache[K]) RemovePendingDelete(key K, uid types.UID) bool
func (*QuantityCache[K]) Snapshot ¶
func (c *QuantityCache[K]) Snapshot() map[K]QuantityEntry
func (*QuantityCache[K]) UpsertReservation ¶
func (c *QuantityCache[K]) UpsertReservation( key K, reservation Reservation, persistedUsed resource.Quantity, limit resource.Quantity, ) (allowed bool, effectiveUsed resource.Quantity, entry QuantityEntry)
UpsertReservation ensures a reservation is idempotent per (key, reservationID). It validates:
persistedUsed + sum(all reservations including this one) <= limit
type QuantityEntry ¶
type RegistryRuleSetCache ¶
type RegistryRuleSetCache struct {
// contains filtered or unexported fields
}
func NewRegistryRuleSetCache ¶
func NewRegistryRuleSetCache() *RegistryRuleSetCache
func (*RegistryRuleSetCache) GetOrBuild ¶
func (c *RegistryRuleSetCache) GetOrBuild(specRules []api.OCIRegistry) (rs *RuleSet, fromCache bool, err error)
func (*RegistryRuleSetCache) Has ¶
func (c *RegistryRuleSetCache) Has(id string) bool
Has is useful in tests and debugging.
func (*RegistryRuleSetCache) HashRules ¶
func (c *RegistryRuleSetCache) HashRules(specRules []api.OCIRegistry) string
func (*RegistryRuleSetCache) PruneActive ¶
func (c *RegistryRuleSetCache) PruneActive(activeIDs map[string]struct{}) int
activeIDs: set of ids currently referenced by RuleStatus in cluster.
func (*RegistryRuleSetCache) Reset ¶
func (c *RegistryRuleSetCache) Reset()
func (*RegistryRuleSetCache) Stats ¶
func (c *RegistryRuleSetCache) Stats() int
type Reservation ¶
Click to show internal directories.
Click to hide internal directories.