Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
Root string // the root cache directory
}
Cache represents an on-disk cache of unpacked tarballs.
It also knows how to populate and trim it.
Directory layout:
<Root>/ <artifact's sha256 hex digest>/ lock # lock file to manage concurrent access cache.json # bookkeeping info about this cache entry tmp_*.tar.gz # exists temporarily when fetching the tarball tmp_data_*/ # exists temporarily when unpacking the tarball data/ # the unpacked tarball goes here
func (*Cache) WithTarball ¶
func (c *Cache) WithTarball(ctx context.Context, src source.Source, cb func(path string) error) error
WithTarball calls `cb` with a path to the unpacked tarball.
If the cache has such tarball already (as identified by its SHA256 digest), calls `cb` right away. Otherwise fetches and unpacks the tarball first.
`cb` may modify files in the directory if necessary. Modifications will be preserved in the cache, and multiple concurrent WithTarballs calls (perhaps made from different processes) will see each other's modifications, so `cb` should be careful doing them. This is required to allow gaedeploy to generate temporary app-specific GAE YAMLs, which are required by gcloud to be side-by-side with the code being deployed (and thus must reside inside the unpacked tarball directory).