Documentation
¶
Overview ¶
Package artifacts keeps the Controller's cache of software artifacts (server jars): files in the data directory named by their SHA-256, with a database record of what each one is. Downloads are checked against the upstream checksum before they are kept; uploads are kept as unverified.
Index ¶
- Constants
- Variables
- type Cache
- func (c *Cache) Ensure(ctx context.Context, b catalog.Build) (domain.Artifact, error)
- func (c *Cache) EnsurePlugin(ctx context.Context, d PluginDownload) (domain.PluginArtifact, error)
- func (c *Cache) Open(ctx context.Context, id uuid.UUID) (io.ReadCloser, domain.Artifact, error)
- func (c *Cache) OpenPlugin(ctx context.Context, id uuid.UUID) (io.ReadCloser, domain.PluginArtifact, error)
- func (c *Cache) Upload(ctx context.Context, a domain.Artifact, r io.Reader) (domain.Artifact, error)
- func (c *Cache) UploadPlugin(ctx context.Context, fileName string, r io.Reader, by *uuid.UUID) (domain.PluginArtifact, pluginjar.Info, error)
- type PluginDownload
Constants ¶
const MaxPluginSize = 64 << 20
MaxPluginSize bounds a plugin jar; real ones are a few MiB.
const MaxSize = 512 << 20
MaxSize bounds an artifact; real server jars are under 100 MiB.
Variables ¶
var ( // ErrChecksumMismatch is returned when a download does not match the // checksum upstream published; the file is discarded. ErrChecksumMismatch = errors.New("the download does not match its published checksum") // ErrDownload is returned when a publisher's download fails. ErrDownload = errors.New("the download failed") // ErrTooLarge is returned for an artifact over its size limit. ErrTooLarge = errors.New("the artifact is too large") )
var ErrNotPlugin = pluginjar.ErrNotPlugin
ErrNotPlugin is returned for an upload that is not a plugin jar.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is the artifact cache.
func (*Cache) Ensure ¶
Ensure returns the cached artifact for an upstream build, downloading and verifying it first if needed.
func (*Cache) EnsurePlugin ¶ added in v1.14.0
func (c *Cache) EnsurePlugin(ctx context.Context, d PluginDownload) (domain.PluginArtifact, error)
EnsurePlugin returns the cached jar of a catalog plugin version, downloading it from its publisher and verifying it against the catalog's checksum and size first if needed.
func (*Cache) OpenPlugin ¶ added in v1.14.0
func (c *Cache) OpenPlugin(ctx context.Context, id uuid.UUID) (io.ReadCloser, domain.PluginArtifact, error)
OpenPlugin returns a plugin jar's file.
func (*Cache) Upload ¶
func (c *Cache) Upload(ctx context.Context, a domain.Artifact, r io.Reader) (domain.Artifact, error)
Upload stores an artifact an administrator supplied. It is unverified: nothing upstream vouches for it.
func (*Cache) UploadPlugin ¶ added in v1.14.0
func (c *Cache) UploadPlugin(ctx context.Context, fileName string, r io.Reader, by *uuid.UUID) (domain.PluginArtifact, pluginjar.Info, error)
UploadPlugin stores a plugin jar a user supplied, after checking that it declares a plugin. It is unverified: nothing vouches for it.