Documentation ¶
Index ¶
- type Cache
- func (cache *Cache) Check(ctx context.Context, layerChainID digest.Digest) (*CacheRecord, io.ReadCloser, io.ReadCloser, error)
- func (cache *Cache) Export(ctx context.Context) error
- func (cache *Cache) Import(ctx context.Context) error
- func (cache *Cache) PullBootstrap(ctx context.Context, bootstrapDesc *ocispec.Descriptor, target string) error
- func (cache *Cache) Push(ctx context.Context, desc ocispec.Descriptor, reader io.Reader) error
- func (cache *Cache) Record(records []*CacheRecord)
- type CacheManifest
- type CacheRecord
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache creates an image to store cache records in its image manifest, every record presents the relationship like:
source_layer_chainid -> (nydus_blob_layer_digest, nydus_bootstrap_layer_digest) If the converter hit cache record during build source layer, we can skip the layer building, see cache image example: examples/manifest/cache_manifest.json.
Here is the build cache workflow:
- Import cache records from registry;
- Check cache record using source layer ChainID before layer build, skip layer build if the cache hit;
- Export new cache records to registry;
func (*Cache) Check ¶
func (cache *Cache) Check(ctx context.Context, layerChainID digest.Digest) (*CacheRecord, io.ReadCloser, io.ReadCloser, error)
Check checks bootstrap & blob layer exists in registry or storage backend
func (*Cache) PullBootstrap ¶
func (cache *Cache) PullBootstrap(ctx context.Context, bootstrapDesc *ocispec.Descriptor, target string) error
PullBootstrap pulls bootstrap layer from registry, and unpack to a specified path, we can use it to prepare parent bootstrap for building.
func (*Cache) Record ¶
func (cache *Cache) Record(records []*CacheRecord)
Record puts new bootstrap & blob layer to cache record, it's a limited queue.
type CacheManifest ¶
type CacheRecord ¶
type CacheRecord struct { SourceChainID digest.Digest NydusBlobDesc *ocispec.Descriptor NydusBootstrapDesc *ocispec.Descriptor NydusBootstrapDiffID digest.Digest }
type Opt ¶
type Opt struct { // Maximum records(bootstrap layer + blob layer) in cache image. MaxRecords uint // Make cache image manifest compatible with the docker v2 media // type defined in github.com/containerd/containerd/images. DockerV2Format bool // The blob layer record will not be written to cache image if // the backend be specified, because the blob layer will be uploaded // to backend. Backend backend.Backend }
Opt configures Nydus cache