Package org.elasticsearch.index.store
Class StoreFileMetadata
java.lang.Object
org.elasticsearch.index.store.StoreFileMetadata
- All Implemented Interfaces:
Writeable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.apache.lucene.util.BytesRef
-
Constructor Summary
ConstructorDescriptionStoreFileMetadata
(String name, long length, String checksum, String writtenBy) StoreFileMetadata
(String name, long length, String checksum, String writtenBy, org.apache.lucene.util.BytesRef hash, org.apache.lucene.util.BytesRef writerUuid) Read from a stream. -
Method Summary
Modifier and TypeMethodDescriptionchecksum()
Returns a string representation of the files checksum.org.apache.lucene.util.BytesRef
hash()
Returns a variable length hash of the file represented by this metadata object.boolean
Checks if the bytes returned byhash()
are the contents of the file that this instances refers to.boolean
isSame
(StoreFileMetadata other) Returnstrue
iff the length and the checksums are the same.long
length()
the actual file size on "disk", if compressed, the compressed sizename()
Returns the name of this filetoString()
org.apache.lucene.util.BytesRef
Returns the globally-unique ID that was assigned by theIndexWriter
that originally wrote this file: - For `segments_N` files this isSegmentInfos.getId()
which uniquely identifies the commit.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Returns a String representation of the Lucene version this file has been written by ornull
if unknown
-
Field Details
-
UNAVAILABLE_WRITER_UUID
public static final org.apache.lucene.util.BytesRef UNAVAILABLE_WRITER_UUID
-
-
Constructor Details
-
StoreFileMetadata
-
StoreFileMetadata
-
StoreFileMetadata
Read from a stream.- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
name
Returns the name of this file -
length
public long length()the actual file size on "disk", if compressed, the compressed size -
checksum
Returns a string representation of the files checksum. Since Lucene 4.8 this is a CRC32 checksum written by lucene. -
hashEqualsContents
public boolean hashEqualsContents()Checks if the bytes returned byhash()
are the contents of the file that this instances refers to.- Returns:
true
iffhash()
will return the actual file contents
-
isSame
Returnstrue
iff the length and the checksums are the same. otherwisefalse
-
toString
-
writtenBy
Returns a String representation of the Lucene version this file has been written by ornull
if unknown -
hash
public org.apache.lucene.util.BytesRef hash()Returns a variable length hash of the file represented by this metadata object. This can be the file itself if the file is small enough. If the length of the hash is0
no hash value is available -
writerUuid
public org.apache.lucene.util.BytesRef writerUuid()Returns the globally-unique ID that was assigned by theIndexWriter
that originally wrote this file: - For `segments_N` files this isSegmentInfos.getId()
which uniquely identifies the commit. - For non-generational segment files this isSegmentInfo.getId()
which uniquely identifies the segment. - For generational segment files (i.e. updated docvalues, liv files etc) this isSegmentCommitInfo.getId()
which uniquely identifies the generation of the segment. This ID may beUNAVAILABLE_WRITER_UUID
(i.e. zero-length) if unavilable, e.g.: - The file was written by a version of Lucene prior toVersion.LUCENE_8_6_0
. - The metadata came from a version of Elasticsearch prior toWRITER_UUID_MIN_VERSION
). - The file is not one of the files listed above.
-