Documentation
¶
Index ¶
- Variables
- type Cache
- func (c *Cache) GetHostname() string
- func (c *Cache) GetNar(hash, compression string) (int64, io.ReadCloser, error)
- func (c *Cache) GetNarInfo(ctx context.Context, hash string) (*narinfo.NarInfo, error)
- func (c *Cache) PublicKey() signature.PublicKey
- func (c *Cache) PutNar(_ context.Context, hash, compression string, r io.ReadCloser) error
- func (c *Cache) PutNarInfo(_ context.Context, hash string, r io.ReadCloser) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPathMustBeAbsolute is returned if the given path to New was not absolute. ErrPathMustBeAbsolute = errors.New("path must be absolute") // ErrPathMustExist is returned if the given path to New did not exist. ErrPathMustExist = errors.New("path must exist") // ErrPathMustBeADirectory is returned if the given path to New is not a directory. ErrPathMustBeADirectory = errors.New("path must be a directory") // ErrPathMustBeWritable is returned if the given path to New is not writable. ErrPathMustBeWritable = errors.New("path must be writable") // 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") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents the main cache service.
func (*Cache) GetNar ¶
GetNar returns the nar given a hash and compression from the store. If the nar is not found in the store, it's pulled from an upstream, stored in the stored and finally returned. NOTE: It's the caller responsibility to close the body.
func (*Cache) GetNarInfo ¶
GetNarInfo returns the narInfo given a hash from the store. If the narInfo is not found in the store, it's pulled from an upstream, stored in the stored and finally returned.
func (*Cache) PutNar ¶ added in v0.0.3
PutNar records the NAR (given as an io.Reader) into the store.
func (*Cache) PutNarInfo ¶ added in v0.0.3
PutNarInfo records the narInfo (given as an io.Reader) into the store and signs it.
Click to show internal directories.
Click to hide internal directories.