public static final class Store.MetadataSnapshot extends Object implements Iterable<StoreFileMetaData>, Writeable<Store.MetadataSnapshot>
Note: This class will ignore the segments.gen file since it's optional and might change concurrently for safety reasons.
StoreFileMetaData| 修飾子とタイプ | フィールドと説明 |
|---|---|
static Store.MetadataSnapshot |
EMPTY |
| コンストラクタと説明 |
|---|
MetadataSnapshot(Map<String,StoreFileMetaData> metadata,
Map<String,String> commitUserData,
long numDocs) |
MetadataSnapshot(StreamInput in) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
Map<String,StoreFileMetaData> |
asMap() |
boolean |
contains(String existingFile)
Returns true iff this metadata contains the given file.
|
StoreFileMetaData |
get(String name) |
Map<String,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.
|
String |
getSyncId()
Returns the sync id of the commit point that this MetadataSnapshot represents.
|
static void |
hashFile(org.apache.lucene.util.BytesRefBuilder fileHash,
InputStream in,
long size)
Computes a strong hash value for small files.
|
static org.apache.lucene.util.BytesRef |
hashFile(org.apache.lucene.store.Directory directory,
String file)
Computes a strong hash value for small files.
|
Iterator<StoreFileMetaData> |
iterator() |
Store.MetadataSnapshot |
readFrom(StreamInput in)
Reads a copy of an object with the same type form the stream input
The caller object remains unchanged.
|
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)
Writes the current object into the output stream out
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final Store.MetadataSnapshot EMPTY
public MetadataSnapshot(Map<String,StoreFileMetaData> metadata, Map<String,String> commitUserData, long numDocs)
public MetadataSnapshot(StreamInput in) throws IOException
IOExceptionpublic long getNumDocs()
public static org.apache.lucene.util.BytesRef hashFile(org.apache.lucene.store.Directory directory,
String file)
throws IOException
IOExceptionpublic static void hashFile(org.apache.lucene.util.BytesRefBuilder fileHash,
InputStream in,
long size)
throws IOException
IOExceptionpublic Iterator<StoreFileMetaData> iterator()
iterator インタフェース内 Iterable<StoreFileMetaData>public StoreFileMetaData get(String name)
public Map<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 void writeTo(StreamOutput out) throws IOException
WriteablewriteTo インタフェース内 Writeable<Store.MetadataSnapshot>IOExceptionpublic boolean contains(String existingFile)
public StoreFileMetaData getSegmentsFile()
public String getSyncId()
public Store.MetadataSnapshot readFrom(StreamInput in) throws IOException
StreamableReaderreadFrom インタフェース内 StreamableReader<Store.MetadataSnapshot>IOExceptionCopyright © 2009–2016. All rights reserved.