public class DefaultOnDiskBuildInfo extends Object implements OnDiskBuildInfo
BuildInfoRecorder when the rule was built initially.
Such metadata is stored as key/value pairs.
| Constructor and Description |
|---|
DefaultOnDiskBuildInfo(BuildTarget target,
ProjectFilesystem projectFilesystem,
BuildInfoStore buildInfoStore) |
| Modifier and Type | Method and Description |
|---|---|
void |
calculateOutputSizeAndWriteMetadata(FileHashLoader fileHashLoader,
com.google.common.collect.ImmutableSortedSet<Path> recordedPaths,
com.google.common.base.Predicate<Long> shouldWriteOutputHashes) |
void |
deleteExistingMetadata()
Deletes both "artifact" and "build" metadata.
|
Optional<String> |
getBuildValue(String key) |
Optional<com.google.common.collect.ImmutableMap<String,String>> |
getMap(String key) |
com.google.common.collect.ImmutableSortedMap<String,String> |
getMetadataForArtifact()
Returns the "build" metadata that is stored with a cache artifact ("artifact" metadata is
stored within the artifact itself).
|
com.google.common.collect.ImmutableSortedSet<Path> |
getOutputPaths() |
com.google.common.collect.ImmutableSortedSet<Path> |
getPathsForArtifact()
Returns the recorded output paths of the rule for creating a cache artifact.
|
Optional<RuleKey> |
getRuleKey(String key)
Returns the
RuleKey for the rule whose output is currently stored on disk. |
Either<String,Exception> |
getValue(String key) |
Optional<com.google.common.collect.ImmutableList<String>> |
getValues(String key) |
com.google.common.collect.ImmutableList<String> |
getValuesOrThrow(String key)
Tries to read the "artifact" values and if it fails it logs the attributes of the file it tried
to read.
|
void |
validateArtifact(Set<Path> extractedFiles) |
public DefaultOnDiskBuildInfo(BuildTarget target, ProjectFilesystem projectFilesystem, BuildInfoStore buildInfoStore)
public Either<String,Exception> getValue(String key)
getValue in interface OnDiskBuildInfopublic Optional<String> getBuildValue(String key)
getBuildValue in interface OnDiskBuildInfopublic Optional<com.google.common.collect.ImmutableList<String>> getValues(String key)
getValues in interface OnDiskBuildInfopublic com.google.common.collect.ImmutableList<String> getValuesOrThrow(String key) throws IOException
OnDiskBuildInfogetValuesOrThrow in interface OnDiskBuildInfoIOExceptionpublic Optional<com.google.common.collect.ImmutableMap<String,String>> getMap(String key)
getMap in interface OnDiskBuildInfopublic com.google.common.collect.ImmutableSortedSet<Path> getOutputPaths()
getOutputPaths in interface OnDiskBuildInfopublic com.google.common.collect.ImmutableSortedSet<Path> getPathsForArtifact() throws IOException
OnDiskBuildInfogetPathsForArtifact in interface OnDiskBuildInfoIOExceptionpublic com.google.common.collect.ImmutableSortedMap<String,String> getMetadataForArtifact() throws IOException
OnDiskBuildInfogetMetadataForArtifact in interface OnDiskBuildInfoIOExceptionpublic Optional<RuleKey> getRuleKey(String key)
OnDiskBuildInfoRuleKey for the rule whose output is currently stored on disk.
This value would have been written the last time the rule was built successfully.
getRuleKey in interface OnDiskBuildInfopublic void deleteExistingMetadata()
throws IOException
OnDiskBuildInfodeleteExistingMetadata in interface OnDiskBuildInfoIOExceptionpublic void calculateOutputSizeAndWriteMetadata(FileHashLoader fileHashLoader, com.google.common.collect.ImmutableSortedSet<Path> recordedPaths, com.google.common.base.Predicate<Long> shouldWriteOutputHashes) throws IOException
calculateOutputSizeAndWriteMetadata in interface OnDiskBuildInfoIOExceptionpublic void validateArtifact(Set<Path> extractedFiles) throws IOException
validateArtifact in interface OnDiskBuildInfoIOException