Package org.elasticsearch.index.store
Class StoreFileMetadata
java.lang.Object
org.elasticsearch.index.store.StoreFileMetadata
- All Implemented Interfaces:
Writeable
public class StoreFileMetadata extends java.lang.Object implements Writeable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Constructor Summary
Constructors Constructor Description StoreFileMetadata(java.lang.String name, long length, java.lang.String checksum, org.apache.lucene.util.Version writtenBy)
StoreFileMetadata(java.lang.String name, long length, java.lang.String checksum, org.apache.lucene.util.Version writtenBy, org.apache.lucene.util.BytesRef hash)
StoreFileMetadata(StreamInput in)
Read from a stream. -
Method Summary
Modifier and Type Method Description java.lang.String
checksum()
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
hashEqualsContents()
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 sizejava.lang.String
name()
Returns the name of this filejava.lang.String
toString()
void
writeTo(StreamOutput out)
Write this into the StreamOutput.org.apache.lucene.util.Version
writtenBy()
Returns the Lucene version this file has been written by ornull
if unknown
-
Constructor Details
-
StoreFileMetadata
public StoreFileMetadata(java.lang.String name, long length, java.lang.String checksum, org.apache.lucene.util.Version writtenBy) -
StoreFileMetadata
public StoreFileMetadata(java.lang.String name, long length, java.lang.String checksum, org.apache.lucene.util.Version writtenBy, org.apache.lucene.util.BytesRef hash) -
StoreFileMetadata
Read from a stream.- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
name
public java.lang.String name()Returns the name of this file -
length
public long length()the actual file size on "disk", if compressed, the compressed size -
checksum
public java.lang.String 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
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
writtenBy
public org.apache.lucene.util.Version writtenBy()Returns 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
-