Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvictCluster ¶ added in v2.32.0
func EvictCluster(clusterPath logicalcluster.Path)
EvictCluster notifies every registered cache that clusterPath has been deleted and its cached client (and everything that client transitively pins — REST client, codec factory, JSON decoder state, OpenAPI schemas) can be released. Wire this to a LogicalCluster delete handler to bound retained memory per workspace lifetime. See https://github.com/kcp-dev/kcp/issues/4071.
Dead entries (caches whose only remaining reference was the weak entry in this registry) are pruned in-place during the iteration.
func SetCluster ¶
SetCluster modifies the config host path to include the cluster endpoint.
Note: it is the caller responsibility to make a copy of the rest config.
Types ¶
type Cache ¶
type Cache[R any] interface { ClusterOrDie(clusterPath logicalcluster.Path) R Cluster(clusterPath logicalcluster.Path) (R, error) // Evict drops the cached client for clusterPath, if any. Used to release // per-cluster client state (REST clients, codec factories, parsed // schemas) when a logical cluster is deleted. Safe to call concurrently // with Cluster / ClusterOrDie. No-op if the path is not cached. Evict(clusterPath logicalcluster.Path) }
Cache is a client factory that caches previous results.
func NewCache ¶
NewCache creates a new client factory cache using the given constructor. The cache is auto-registered with the package-level EvictCluster fan-out so per-cluster entries can be released when a LogicalCluster is deleted. The registry holds the cache weakly: if all references to the returned Cache are dropped, it becomes eligible for GC and is pruned from the registry lazily.
type ClusterAwareRateLimiter ¶ added in v2.34.0
type ClusterAwareRateLimiter interface {
flowcontrol.RateLimiter
Cluster(clusterPath logicalcluster.Path) flowcontrol.RateLimiter
}
type ClusterRateLimiter ¶ added in v2.34.0
type ClusterRateLimiter struct {
flowcontrol.RateLimiter
// contains filtered or unexported fields
}
func NewClusterRateLimiter ¶ added in v2.34.0
func NewClusterRateLimiter(qps float32, burst int) *ClusterRateLimiter
func (*ClusterRateLimiter) Cluster ¶ added in v2.34.0
func (l *ClusterRateLimiter) Cluster(clusterPath logicalcluster.Path) flowcontrol.RateLimiter
func (*ClusterRateLimiter) Evict ¶ added in v2.34.0
func (l *ClusterRateLimiter) Evict(clusterPath logicalcluster.Path)
type Constructor ¶
type Constructor[R any] struct { NewForConfigAndClient func(*rest.Config, *http.Client) (R, error) }
Constructor is a wrapper around a constructor method for the client of type R.
type GroupAwareRateLimiter ¶ added in v2.34.0
type GroupAwareRateLimiter interface {
flowcontrol.RateLimiter
Group(groupVersion schema.GroupVersion) flowcontrol.RateLimiter
}