Record Class BlobIndex
java.lang.Object
java.lang.Record
network.ike.docs.plugin.registry.BlobIndex
- Record Components:
blobs- the files, path to blob id, iterating in path orderfindings- what the index could not take: a symbolic link, prefixed with the path it concernssource- where the ids came from
public record BlobIndex(Map<String,String> blobs, List<String> findings, BlobIndex.Source source)
extends Record
Every
.adoc file under a registry root with the git blob id of its
content: the key the incremental registry decides staleness by
(dev-adoc-packages, IKE-Network/ike-issues#1341). Dates are the
wrong key, since a checkout, a rebase, a sync between machines or a
restored file all change dates without changing content; the blob id
addresses the content itself, and git already keeps it for every tracked
file. GitBlobIndex reads it from git without opening a file;
hashed(Path) is the fallback for a tree without git, which
reads every file once to compute the same id, so the two never disagree
about an unchanged file.
Paths are relative to the root with / separators, in path
order, with the directories TopicRegistry.SKIPPED_DIRS left out,
as the full scan leaves them out. A symbolic link is never followed; it
is a finding instead, as it is in the full scan.
- Since:
- 136
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringblobId(byte[] content) The git blob id of content: the SHA-1 of"blob <length>\0"followed by the bytes, asgit hash-objectcomputes it for a file with no clean filter.blobs()Returns the value of theblobsrecord component.final booleanIndicates whether some other object is "equal to" this one.findings()Returns the value of thefindingsrecord component.final inthashCode()Returns a hash code value for this object.static BlobIndexIndex a root by reading every.adocfile under it and hashing the content as git hashes a blob ("blob " + length + NUL + content, SHA-1).source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
hashed
Index a root by reading every.adocfile under it and hashing the content as git hashes a blob ("blob " + length + NUL + content, SHA-1). This is the full scan's cost, paid when git is not there to answer for free.- Parameters:
root- the registry root- Returns:
- the index
- Throws:
IOException- if the tree cannot be read
-
blobId
The git blob id of content: the SHA-1 of"blob <length>\0"followed by the bytes, asgit hash-objectcomputes it for a file with no clean filter.- Parameters:
content- the file content- Returns:
- the forty-character lowercase hex id
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
blobs
-
findings
-
source
-