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.
StoreFileMetaDataWriteable.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() |
java.lang.String |
getHistoryUUID()
returns the history uuid the store points at, or null if not existant.
|
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.
|
java.lang.String |
getTranslogUUID()
returns the translog uuid the store points at
|
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.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablepublic long getNumDocs()
public static void hashFile(org.apache.lucene.util.BytesRefBuilder fileHash,
java.io.InputStream in,
long size)
throws java.io.IOException
java.io.IOExceptionpublic 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 java.lang.String getHistoryUUID()
public java.lang.String getTranslogUUID()
public boolean contains(java.lang.String existingFile)
public StoreFileMetaData getSegmentsFile()
public java.lang.String getSyncId()