Documentation
¶
Index ¶
- Constants
- func BuildCacheMounts(providers []string) []string
- func ParseVolumeName(name string) (workspaceID, provider string)
- func SupportedProviders() []string
- func ValidateProviders(providers []string) []string
- func VolumeName(workspaceID, provider string) string
- func VolumePrefix(workspaceID string) string
- type Plugin
Constants ¶
const GlobalVolumePrefix = "crib-cache-"
GlobalVolumePrefix is the prefix shared by all crib cache volumes.
Variables ¶
This section is empty.
Functions ¶
func BuildCacheMounts ¶
BuildCacheMounts returns cache mount target paths for use during image builds. Feature install scripts run as root, so home-relative paths use /root. For apt, both /var/cache/apt and /var/lib/apt/lists are included.
func ParseVolumeName ¶ added in v0.8.0
ParseVolumeName extracts workspace ID and provider from a cache volume name. Volume names follow the pattern "crib-cache-{wsID}-{provider}", but compose workspaces may have a "{project}_" prefix (e.g. "crib-web_crib-cache-web-apt"). All provider names are single words (no hyphens), so the provider is the segment after the last hyphen in the suffix after "crib-cache-".
func SupportedProviders ¶
func SupportedProviders() []string
SupportedProviders returns the list of known cache provider names.
func ValidateProviders ¶
ValidateProviders returns provider names that are not recognized.
func VolumeName ¶
VolumeName returns the Docker volume name for a workspace's cache provider.
func VolumePrefix ¶
VolumePrefix returns the volume name prefix for a workspace's cache volumes.
Types ¶
type Plugin ¶
type Plugin struct {
plugin.BasePlugin
// contains filtered or unexported fields
}
Plugin shares host package caches via named Docker volumes.
func New ¶
New creates a package cache plugin for the given providers. Unknown providers are skipped at runtime. Use ValidateProviders to check for unknown names before creating the plugin.
func (*Plugin) PreContainerRun ¶
func (p *Plugin) PreContainerRun(_ context.Context, req *plugin.PreContainerRunRequest) (*plugin.PreContainerRunResponse, error)
PreContainerRun returns volume mounts for each configured cache provider.