Class BlobStoreIndexShardSnapshot.FileInfo
- java.lang.Object
-
- org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo
-
- Enclosing class:
- BlobStoreIndexShardSnapshot
public static class BlobStoreIndexShardSnapshot.FileInfo extends java.lang.Object
Information about snapshotted file
-
-
Constructor Summary
Constructors Constructor Description FileInfo(java.lang.String name, StoreFileMetaData metaData, ByteSizeValue partSize)
Constructs a new instance of file info
-
Method Summary
Modifier and Type Method Description static java.lang.String
canonicalName(java.lang.String blobName)
Returns base file name from part namejava.lang.String
checksum()
Returns file md5 checksum provided byStore
static BlobStoreIndexShardSnapshot.FileInfo
fromXContent(XContentParser parser)
Parses JSON that represents file infoboolean
hasUnknownChecksum()
Checks if the checksum for the file is unknown.boolean
isSame(BlobStoreIndexShardSnapshot.FileInfo fileInfo)
Checks if a file in a store is the same fileboolean
isSame(StoreFileMetaData md)
Checks if a file in a store is the same filelong
length()
File lengthStoreFileMetaData
metadata()
Returns the StoreFileMetaData for this file info.java.lang.String
name()
Returns the base file namelong
numberOfParts()
Returns number of partslong
partBytes(int part)
Returns the size (in bytes) of a given partjava.lang.String
partName(long part)
Returns part name if file is stored as multiple partsByteSizeValue
partSize()
Returns part sizejava.lang.String
physicalName()
Returns original file namejava.lang.String
toString()
static void
toXContent(BlobStoreIndexShardSnapshot.FileInfo file, XContentBuilder builder, ToXContent.Params params)
Serializes file info into JSON
-
-
-
Constructor Detail
-
FileInfo
public FileInfo(java.lang.String name, StoreFileMetaData metaData, ByteSizeValue partSize)
Constructs a new instance of file info- Parameters:
name
- file name as stored in the blob storemetaData
- the files meta datapartSize
- size of the single chunk
-
-
Method Detail
-
name
public java.lang.String name()
Returns the base file name- Returns:
- file name
-
partName
public java.lang.String partName(long part)
Returns part name if file is stored as multiple parts- Parameters:
part
- part number- Returns:
- part name
-
canonicalName
public static java.lang.String canonicalName(java.lang.String blobName)
Returns base file name from part name- Parameters:
blobName
- part name- Returns:
- base file name
-
physicalName
public java.lang.String physicalName()
Returns original file name- Returns:
- original file name
-
length
public long length()
File length- Returns:
- file length
-
partSize
public ByteSizeValue partSize()
Returns part size- Returns:
- part size
-
partBytes
public long partBytes(int part)
Returns the size (in bytes) of a given part- Returns:
- the size (in bytes) of a given part
-
numberOfParts
public long numberOfParts()
Returns number of parts- Returns:
- number of parts
-
checksum
public java.lang.String checksum()
Returns file md5 checksum provided byStore
- Returns:
- file checksum
-
metadata
public StoreFileMetaData metadata()
Returns the StoreFileMetaData for this file info.
-
isSame
public boolean isSame(StoreFileMetaData md)
Checks if a file in a store is the same file- Parameters:
md
- file in a store- Returns:
- true if file in a store this this file have the same checksum and length
-
isSame
public boolean isSame(BlobStoreIndexShardSnapshot.FileInfo fileInfo)
Checks if a file in a store is the same file- Parameters:
fileInfo
- file in a store- Returns:
- true if file in a store this this file have the same checksum and length
-
hasUnknownChecksum
public boolean hasUnknownChecksum()
Checks if the checksum for the file is unknown. This only is possible on an empty shard's segments_N file which was created in older Lucene versions.
-
toXContent
public static void toXContent(BlobStoreIndexShardSnapshot.FileInfo file, XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
Serializes file info into JSON- Parameters:
file
- file infobuilder
- XContent builderparams
- parameters- Throws:
java.io.IOException
-
fromXContent
public static BlobStoreIndexShardSnapshot.FileInfo fromXContent(XContentParser parser) throws java.io.IOException
Parses JSON that represents file info- Parameters:
parser
- parser- Returns:
- file info
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-