disk

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCacheRoundTripper

func NewCacheRoundTripper(cachDir string, rt http.RoundTripper) http.RoundTripper

Types

type CacheRoundTripper

type CacheRoundTripper interface {
	RoundTrip(req *http.Request) (*http.Response, error)
	CancelRequest(req *http.Request)
}

type CachedDiscoveryClient

type CachedDiscoveryClient interface {
	ServerResourcesForGroupVersion(string) (*metav1.APIResourceList, error)
	ServerResources() ([]*metav1.APIResourceList, error)
	ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error)
	ServerGroups() (*metav1.APIGroupList, error)
	RESTClient() restclient.Interface
	ServerPreferredResources() ([]*metav1.APIResourceList, error)
	ServerPreferredNamespacedResources() ([]*metav1.APIResourceList, error)
	ServerVersion() (*version.Info, error)
	OpenAPISchema() (*openapi_v2.Document, error)
	Fresh() bool
	Invalidate()
}

func NewCachedDiscoveryClient

func NewCachedDiscoveryClient(delegate discovery.DiscoveryInterface, cacheDirectory string, ttl time.Duration) CachedDiscoveryClient

func NewCachedDiscoveryClientForConfig

func NewCachedDiscoveryClientForConfig(config *restclient.Config, discoveryCacheDir, httpCacheDir string, ttl time.Duration) (CachedDiscoveryClient, error)

NewCachedDiscoveryClientForConfig creates a new DiscoveryClient for the given config, and wraps the created client in a CachedDiscoveryClient. The provided configuration is updated with a custom transport that understands cache responses. We receive two distinct cache directories for now, in order to preserve old behavior which makes use of the --cache-dir flag value for storing cache data from the CacheRoundTripper, and makes use of the hardcoded destination (~/.kube/cache/discovery/...) for storing CachedDiscoveryClient cache data. If httpCacheDir is empty, the restconfig's transport will not be updated with a roundtripper that understands cache responses. If discoveryCacheDir is empty, cached server resource data will be looked up in the current directory.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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