Documentation
¶
Index ¶
- Variables
- type Cache
- func (c *Cache) GetHostname() string
- func (c *Cache) GetNar(ctx context.Context, narURL nar.URL, mutators ...func(*http.Request)) (*http.Response, error)
- func (c *Cache) GetNarInfo(ctx context.Context, hash string) (*narinfo.NarInfo, error)
- func (c *Cache) GetPriority() uint64
- func (c *Cache) HasNar(ctx context.Context, narURL nar.URL, mutators ...func(*http.Request)) (bool, error)
- func (c *Cache) HasNarInfo(ctx context.Context, hash string) (bool, error)
- func (c *Cache) IsHealthy() bool
- func (c *Cache) ParsePriority(ctx context.Context) (uint64, error)
- func (c *Cache) SetHealthy(isHealthy bool)
- func (c *Cache) SetPriority(priority uint64)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrURLRequired is returned if the given URL to New is not given. ErrURLRequired = errors.New("the URL is required") // ErrURLMustContainScheme is returned if the given URL to New did not contain a scheme. ErrURLMustContainScheme = errors.New("the URL must contain scheme") // ErrInvalidURL is returned if the given hostName to New is not valid. ErrInvalidURL = errors.New("the URL is not valid") // 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") // ErrTransportCastError is returned if it was not possible to cast http.DefaultTransport to *http.Transport. ErrTransportCastError = errors.New("unable to cast http.DefaultTransport to *http.Transport") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents the upstream cache service.
func (*Cache) GetNar ¶
func (c *Cache) GetNar(ctx context.Context, narURL nar.URL, mutators ...func(*http.Request)) (*http.Response, error)
GetNar returns the NAR archive from the cache server. NOTE: It's the caller responsibility to close the body.
func (*Cache) GetNarInfo ¶
GetNarInfo returns a parsed NarInfo from the cache server.
func (*Cache) GetPriority ¶
GetPriority returns the priority of this upstream cache.
func (*Cache) HasNar ¶ added in v0.0.20
func (c *Cache) HasNar(ctx context.Context, narURL nar.URL, mutators ...func(*http.Request)) (bool, error)
HasNar returns true if the NAR exists upstream.
func (*Cache) HasNarInfo ¶ added in v0.0.20
HasNarInfo returns true if the narinfo exists upstream.
func (*Cache) ParsePriority ¶ added in v0.3.0
ParsePriority parses the priority from the upstream.
func (*Cache) SetHealthy ¶ added in v0.3.0
SetHealthy sets the health status of the upstream.
func (*Cache) SetPriority ¶ added in v0.3.0
SetPriority sets the priority of the upstream.
Click to show internal directories.
Click to hide internal directories.