client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Get returns cache for a specified catalog name and version (resolvedRef).
	//
	// Method behaviour is as follows:
	//   - If cache exists, it returns a non-nil fs.FS and nil error
	//   - If cache doesn't exist, it returns nil fs.FS and nil error
	//   - If there was an error during cache population,
	//     it returns nil fs.FS and the error from the cache population.
	//     In other words - cache population errors are also cached.
	Get(catalogName, resolvedRef string) (fs.FS, error)

	// Put writes content from source or from errToCache in the cache backend
	// for a specified catalog name and version (resolvedRef).
	//
	// Method behaviour is as follows:
	//   - If successfully populated cache for catalogName and resolvedRef exists,
	//     errToCache is ignored and existing cache returned with nil error
	//   - If existing cache for catalogName and resolvedRef exists but
	//     is populated with an error, update the cache with either
	//     new content from source or errToCache.
	//   - If cache doesn't exist, populate it with either new content
	//     from source or errToCache.
	Put(catalogName, resolvedRef string, source io.Reader, errToCache error) (fs.FS, error)
}

type Client

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

Client is reading catalog metadata

func New

func New(cache Cache, httpClient func() (*http.Client, error)) *Client

func (*Client) GetPackage

func (c *Client) GetPackage(ctx context.Context, catalog *ocv1.ClusterCatalog, pkgName string) (*declcfg.DeclarativeConfig, error)

func (*Client) PopulateCache

func (c *Client) PopulateCache(ctx context.Context, catalog *ocv1.ClusterCatalog) (fs.FS, error)

Jump to

Keyboard shortcuts

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