Class StoreFileMetadata

java.lang.Object
org.elasticsearch.index.store.StoreFileMetadata
All Implemented Interfaces:
Writeable

public class StoreFileMetadata extends Object implements Writeable
  • Field Details

    • UNAVAILABLE_WRITER_UUID

      public static final org.apache.lucene.util.BytesRef UNAVAILABLE_WRITER_UUID
  • Constructor Details

    • StoreFileMetadata

      public StoreFileMetadata(String name, long length, String checksum, String writtenBy)
    • StoreFileMetadata

      public StoreFileMetadata(String name, long length, String checksum, String writtenBy, org.apache.lucene.util.BytesRef hash, org.apache.lucene.util.BytesRef writerUuid)
    • StoreFileMetadata

      public StoreFileMetadata(StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • name

      public 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 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 by hash() are the contents of the file that this instances refers to.
      Returns:
      true iff hash() will return the actual file contents
    • isSame

      public boolean isSame(StoreFileMetadata other)
      Returns true iff the length and the checksums are the same. otherwise false
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writtenBy

      public String writtenBy()
      Returns a String representation of the Lucene version this file has been written by or null 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 is 0 no hash value is available
    • writerUuid

      public org.apache.lucene.util.BytesRef writerUuid()
      Returns the globally-unique ID that was assigned by the IndexWriter that originally wrote this file: - For `segments_N` files this is SegmentInfos.getId() which uniquely identifies the commit. - For non-generational segment files this is SegmentInfo.getId() which uniquely identifies the segment. - For generational segment files (i.e. updated docvalues, liv files etc) this is SegmentCommitInfo.getId() which uniquely identifies the generation of the segment. This ID may be UNAVAILABLE_WRITER_UUID (i.e. zero-length) if unavilable, e.g.: - The file was written by a version of Lucene prior to Version.LUCENE_8_6_0. - The metadata came from a version of Elasticsearch prior to WRITER_UUID_MIN_VERSION). - The file is not one of the files listed above.