public class CacheReader
extends java.lang.Object
| Constructor and Description |
|---|
CacheReader(Cache cache) |
| Modifier and Type | Method and Description |
|---|---|
CachedLayer |
getLayer(DescriptorDigest layerDigest) |
java.nio.file.Path |
getLayerFile(com.google.common.collect.ImmutableList<LayerEntry> layerEntries)
Finds the file that stores the content BLOB for an application layer.
|
CachedLayerWithMetadata |
getUpToDateLayerByLayerEntries(com.google.common.collect.ImmutableList<LayerEntry> layerEntries)
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 java.nio.file.Path getLayerFile(com.google.common.collect.ImmutableList<LayerEntry> layerEntries) throws CacheMetadataCorruptedException
layerEntries - the entries for the layer contentlayerType and sourceFiles, or null if there is no match.CacheMetadataCorruptedException - if getting the cache metadata fails.@Nullable public CachedLayerWithMetadata getUpToDateLayerByLayerEntries(com.google.common.collect.ImmutableList<LayerEntry> layerEntries) throws java.io.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).
layerEntries - the layer's content entriesjava.io.IOException - if reading the source files fails.CacheMetadataCorruptedException - if reading the cache metadata fails.