Integrate layer info cache with registry and storage
This changeset integrates the layer info cache with the registry webapp and storage backend. The main benefit is to cache immutable layer meta data, reducing backend roundtrips. The cache can be configured to use either redis or an inmemory cache. This provides massive performance benefits for HEAD http checks on layer blobs and manifest verification. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -17,6 +17,21 @@ type layerReader struct {
|
||||
digest digest.Digest
|
||||
}
|
||||
|
||||
// newLayerReader returns a new layerReader with the digest, path and length,
|
||||
// eliding round trips to the storage backend.
|
||||
func newLayerReader(driver driver.StorageDriver, dgst digest.Digest, path string, length int64) (*layerReader, error) {
|
||||
fr := &fileReader{
|
||||
driver: driver,
|
||||
path: path,
|
||||
size: length,
|
||||
}
|
||||
|
||||
return &layerReader{
|
||||
fileReader: *fr,
|
||||
digest: dgst,
|
||||
}, nil
|
||||
}
|
||||
|
||||
var _ distribution.Layer = &layerReader{}
|
||||
|
||||
func (lr *layerReader) Digest() digest.Digest {
|
||||
|
Reference in New Issue
Block a user