public static final class Store.MetadataSnapshot extends java.lang.Object implements java.lang.Iterable<StoreFileMetaData>, Writeable
Note: This class will ignore the segments.gen file since it's optional and might change concurrently for safety reasons.
StoreFileMetaData
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
static Store.MetadataSnapshot |
EMPTY |
Constructor and Description |
---|
MetadataSnapshot(java.util.Map<java.lang.String,StoreFileMetaData> metadata,
java.util.Map<java.lang.String,java.lang.String> commitUserData,
long numDocs) |
MetadataSnapshot(StreamInput in)
Read from a stream.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,StoreFileMetaData> |
asMap() |
boolean |
contains(java.lang.String existingFile)
Returns true iff this metadata contains the given file.
|
StoreFileMetaData |
get(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.String> |
getCommitUserData() |
long |
getNumDocs()
Returns the number of documents in this store snapshot
|
StoreFileMetaData |
getSegmentsFile()
Returns the segments file that this metadata snapshot represents or null if the snapshot is empty.
|
java.lang.String |
getSyncId()
Returns the sync id of the commit point that this MetadataSnapshot represents.
|
static void |
hashFile(org.apache.lucene.util.BytesRefBuilder fileHash,
java.io.InputStream in,
long size)
Computes a strong hash value for small files.
|
java.util.Iterator<StoreFileMetaData> |
iterator() |
Store.RecoveryDiff |
recoveryDiff(Store.MetadataSnapshot recoveryTargetSnapshot)
Returns a diff between the two snapshots that can be used for recovery.
|
int |
size()
Returns the number of files in this snapshot
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
public static final Store.MetadataSnapshot EMPTY
public MetadataSnapshot(java.util.Map<java.lang.String,StoreFileMetaData> metadata, java.util.Map<java.lang.String,java.lang.String> commitUserData, long numDocs)
public MetadataSnapshot(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
public long getNumDocs()
public static void hashFile(org.apache.lucene.util.BytesRefBuilder fileHash, java.io.InputStream in, long size) throws java.io.IOException
java.io.IOException
public java.util.Iterator<StoreFileMetaData> iterator()
iterator
in interface java.lang.Iterable<StoreFileMetaData>
public StoreFileMetaData get(java.lang.String name)
public java.util.Map<java.lang.String,StoreFileMetaData> asMap()
public Store.RecoveryDiff recoveryDiff(Store.MetadataSnapshot recoveryTargetSnapshot)
The .si file contains a lot of diagnostics including a timestamp etc. in the future there might be unique segment identifiers in there hardening this method further.
The per-commit files handles very similar. A commit is composed of the segments_N files as well as generational files like deletes (_x_y.del) or field-info (_x_y.fnm) files. On a per-commit level files for a commit are treated as identical iff:
NOTE: this diff will not contain the segments.gen file. This file is omitted on recovery.
public int size()
public java.util.Map<java.lang.String,java.lang.String> getCommitUserData()
public boolean contains(java.lang.String existingFile)
public StoreFileMetaData getSegmentsFile()
public java.lang.String getSyncId()