Class ChecksumBlobStoreFormat<T extends ToXContent>
- java.lang.Object
-
- org.elasticsearch.repositories.blobstore.BlobStoreFormat<T>
-
- org.elasticsearch.repositories.blobstore.ChecksumBlobStoreFormat<T>
-
public class ChecksumBlobStoreFormat<T extends ToXContent> extends BlobStoreFormat<T>
Snapshot metadata file format used in v2.0 and above
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancompressstatic intVERSIONprotected XContentTypexContentType-
Fields inherited from class org.elasticsearch.repositories.blobstore.BlobStoreFormat
blobNameFormat, namedXContentRegistry, reader, SNAPSHOT_ONLY_FORMAT_PARAMS
-
-
Constructor Summary
Constructors Constructor Description ChecksumBlobStoreFormat(java.lang.String codec, java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry, boolean compress)ChecksumBlobStoreFormat(java.lang.String codec, java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry, boolean compress, XContentType xContentType)
-
Method Summary
Modifier and Type Method Description TreadBlob(BlobContainer blobContainer, java.lang.String blobName)Reads blob with specified name without resolving the blobName using usingBlobStoreFormat.blobName(java.lang.String)method.protected BytesReferencewrite(T obj)voidwrite(T obj, BlobContainer blobContainer, java.lang.String name)Writes blob with resolving the blob name usingBlobStoreFormat.blobName(java.lang.String)method.protected voidwrite(T obj, StreamOutput streamOutput)voidwriteAtomic(T obj, BlobContainer blobContainer, java.lang.String name)Writes blob in atomic manner with resolving the blob name usingBlobStoreFormat.blobName(java.lang.String)method.
-
-
-
Field Detail
-
VERSION
public static final int VERSION
- See Also:
- Constant Field Values
-
xContentType
protected final XContentType xContentType
-
compress
protected final boolean compress
-
-
Constructor Detail
-
ChecksumBlobStoreFormat
public ChecksumBlobStoreFormat(java.lang.String codec, java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry, boolean compress, XContentType xContentType)- Parameters:
codec- codec nameblobNameFormat- format of the blobname inString.format(java.lang.String, java.lang.Object...)formatreader- prototype object that can deserialize T from XContentcompress- true if the content should be compressedxContentType- content type that should be used for write operations
-
ChecksumBlobStoreFormat
public ChecksumBlobStoreFormat(java.lang.String codec, java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry, boolean compress)- Parameters:
codec- codec nameblobNameFormat- format of the blobname inString.format(java.lang.String, java.lang.Object...)formatreader- prototype object that can deserialize T from XContentcompress- true if the content should be compressed
-
-
Method Detail
-
readBlob
public T readBlob(BlobContainer blobContainer, java.lang.String blobName) throws java.io.IOException
Reads blob with specified name without resolving the blobName using usingBlobStoreFormat.blobName(java.lang.String)method.- Specified by:
readBlobin classBlobStoreFormat<T extends ToXContent>- Parameters:
blobContainer- blob containerblobName- blob name- Returns:
- parsed blob object
- Throws:
java.io.IOException
-
writeAtomic
public void writeAtomic(T obj, BlobContainer blobContainer, java.lang.String name) throws java.io.IOException
Writes blob in atomic manner with resolving the blob name usingBlobStoreFormat.blobName(java.lang.String)method.The blob will be compressed and checksum will be written if required. Atomic move might be very inefficient on some repositories. It also cannot override existing files.
- Parameters:
obj- object to be serializedblobContainer- blob containername- blob name- Throws:
java.io.IOException
-
write
public void write(T obj, BlobContainer blobContainer, java.lang.String name) throws java.io.IOException
Writes blob with resolving the blob name usingBlobStoreFormat.blobName(java.lang.String)method.The blob will be compressed and checksum will be written if required.
- Parameters:
obj- object to be serializedblobContainer- blob containername- blob name- Throws:
java.io.IOException
-
write
protected BytesReference write(T obj) throws java.io.IOException
- Throws:
java.io.IOException
-
write
protected void write(T obj, StreamOutput streamOutput) throws java.io.IOException
- Throws:
java.io.IOException
-
-