upstream

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHostnameRequired is returned if the given hostName to New is not given.
	ErrHostnameRequired = errors.New("hostName is required")

	// ErrHostnameMustNotContainScheme is returned if the given hostName to New contained a scheme.
	ErrHostnameMustNotContainScheme = errors.New("hostName must not contain scheme")

	// ErrHostnameNotValid is returned if the given hostName to New is not valid.
	ErrHostnameNotValid = errors.New("hostName is not valid")

	// ErrHostnameMustNotContainPath is returned if the given hostName to New contained a path.
	ErrHostnameMustNotContainPath = errors.New("hostName must not contain a path")

	// ErrNotFound is returned if the nar or narinfo were not found.
	ErrNotFound = errors.New("not found")

	// ErrUnexpectedHTTPStatusCode is returned if the response has an unexpected status code.
	ErrUnexpectedHTTPStatusCode = errors.New("unexpected HTTP status code")

	// ErrSignatureValidationFailed is returned if the signature validation of the narinfo has failed.
	ErrSignatureValidationFailed = errors.New("signature validation has failed")
)

Functions

This section is empty.

Types

type Cache

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

Cache represents the upstream cache service.

func New

func New(logger log15.Logger, hostName string, pubKeys []string) (Cache, error)

func (Cache) GetHostname

func (c Cache) GetHostname() string

GetHostname returns the hostname.

func (Cache) GetNar

func (c Cache) GetNar(ctx context.Context, hash, compression string) (int64, io.ReadCloser, error)

GetNar returns the NAR archive from the cache server. NOTE: It's the caller responsibility to close the body.

func (Cache) GetNarInfo

func (c Cache) GetNarInfo(ctx context.Context, hash string) (*narinfo.NarInfo, error)

GetNarInfo returns a parsed NarInfo from the cache server.

func (Cache) GetPriority

func (c Cache) GetPriority() uint64

GetPriority returns the priority of this upstream cache.

Jump to

Keyboard shortcuts

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