public class CacheReader extends Object
| Constructor and Description |
|---|
CacheReader(Cache cache) |
| Modifier and Type | Method and Description |
|---|---|
CachedLayer |
getLayer(DescriptorDigest layerDigest) |
Path |
getLayerFile(com.google.common.collect.ImmutableList<Path> sourceFiles)
Finds the file that stores the content BLOB for an application layer.
|
CachedLayerWithMetadata |
getUpToDateLayerBySourceFiles(com.google.common.collect.ImmutableList<Path> sourceFiles)
Gets an up-to-date layer that is built from the
sourceFiles. |
public CacheReader(Cache cache)
@Nullable public CachedLayer getLayer(DescriptorDigest layerDigest)
layerDigest - the layer digest of the layer to get.layerDigest, or null if not found.@Nullable public Path getLayerFile(com.google.common.collect.ImmutableList<Path> sourceFiles) throws CacheMetadataCorruptedException
sourceFiles - the source files the layer must be built from.layerType and sourceFiles, or null if there is no match.CacheMetadataCorruptedException - if getting the cache metadata fails.@Nullable public CachedLayerWithMetadata getUpToDateLayerBySourceFiles(com.google.common.collect.ImmutableList<Path> sourceFiles) throws IOException, CacheMetadataCorruptedException
sourceFiles.
The method returns the first up-to-date layer found. This is safe because the source files will not have been modified since creation of any up-to-date layer (ie. all up-to-date layers should have the same file contents).
sourceFiles - the layer's source files.IOException - if reading the source files fails.CacheMetadataCorruptedException - if reading the cache metadata fails.Copyright © 2018. All rights reserved.