Documentation ¶
Overview ¶
Package cache provides support for caching SIF, OCI, SHUB images and any OCI layers used to build them
Package cache provides support for caching SIF, OCI, SHUB images and any OCI layers used to build them
Index ¶
- Constants
- Variables
- type Config
- type Entry
- type Handle
- func (h *Handle) CleanCache(cacheType string, dryRun bool, days int) (err error)
- func (h *Handle) GetEntry(cacheType string, hash string) (e *Entry, err error)
- func (h *Handle) GetFileCacheDir(cacheType string) (cacheDir string, err error)
- func (h *Handle) GetOciCacheDir(cacheType string) (cacheDir string, err error)
- func (h *Handle) IsDisabled() bool
Constants ¶
View Source
const ( // DirEnv specifies the environment variable which can set the directory // for image downloads to be cached in DirEnv = "APPTAINER_CACHEDIR" // DisableEnv specifies whether the image should be used DisableEnv = "APPTAINER_DISABLE_CACHE" // SubDirName specifies the name of the directory relative to the // ParentDir specified when the cache is created. // By default the cache will be placed at "~/.apptainer/cache" which // will not clash with any 2.x cache directory. SubDirName = "cache" // LibraryCacheType specifies the cache holds SIF images pulled from the library LibraryCacheType = "library" // OciTempCacheType specifies the cache holds SIF images created from OCI sources OciTempCacheType = "oci-tmp" // OciBlobCacheType specifies the cache holds OCI blobs (layers) pulled from OCI sources OciBlobCacheType = "blob" // ShubCacheType specifies the cache holds images pulled from Singularity Hub ShubCacheType = "shub" // OrasCacheType specifies the cache holds SIF images pulled from Oras sources OrasCacheType = "oras" // NetCacheType specifies the cache holds images pulled from http(s) internet sources NetCacheType = "net" )
Variables ¶
View Source
var ( // FileCacheTypes specifies the file cache types. FileCacheTypes = []string{ LibraryCacheType, OciTempCacheType, ShubCacheType, OrasCacheType, NetCacheType, } // OciCacheTypes specifies the OCI cache types. OciCacheTypes = []string{ OciBlobCacheType, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ParentDir specifies the location where the user wants the cache to be created. ParentDir string // Disable specifies whether the user request the cache to be disabled by default. Disable bool }
Config describes the requested configuration requested when a new handle is created, as defined by the user through command flags and environment variables.
type Entry ¶
type Entry struct { // cacheType indicates which subcache / subdir the entry belongs to, e.g. 'library' CacheType string // exists is true if the entry exists in the cache at path Exists bool // path is the location of the entry if exists is true, or the location that a new entry // will take when it is finalized Path string // tmpPath is the temporary location that should be used for a new cache entry as it // is created TmpPath string }
Entry is a structure representing an entry in the cache. An entry is a file under the CacheType subdir within the Cache rootDir
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is an structure representing the image cache, it's location and subdirectories
func (*Handle) CleanCache ¶
func (*Handle) GetFileCacheDir ¶
func (*Handle) GetOciCacheDir ¶
func (*Handle) IsDisabled ¶
IsDisabled returns true if the cache is disabled
Click to show internal directories.
Click to hide internal directories.