Class ChecksumBlobStoreFormat<T extends ToXContent>
- java.lang.Object
-
- org.elasticsearch.repositories.blobstore.ChecksumBlobStoreFormat<T>
-
public final class ChecksumBlobStoreFormat<T extends ToXContent> extends Object
Snapshot metadata file format used in v2.0 and above
-
-
Field Summary
Fields Modifier and Type Field Description static intVERSION
-
Constructor Summary
Constructors Constructor Description ChecksumBlobStoreFormat(String codec, String blobNameFormat, CheckedFunction<XContentParser,T,IOException> reader, NamedXContentRegistry namedXContentRegistry, boolean compress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringblobName(String name)voiddelete(BlobContainer blobContainer, String name)Deletes obj in the blob containerTread(BlobContainer blobContainer, String name)Reads and parses the blob with given name, applying name translation using the {link #blobName} methodTreadBlob(BlobContainer blobContainer, String blobName)Reads blob with specified name without resolving the blobName using usingblobName(java.lang.String)method.voidwrite(T obj, BlobContainer blobContainer, String name, boolean failIfAlreadyExists)Writes blob with resolving the blob name usingblobName(java.lang.String)method.voidwriteAtomic(T obj, BlobContainer blobContainer, String name)Writes blob in atomic manner with resolving the blob name usingblobName(java.lang.String)method.
-
-
-
Field Detail
-
VERSION
public static final int VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChecksumBlobStoreFormat
public ChecksumBlobStoreFormat(String codec, String blobNameFormat, CheckedFunction<XContentParser,T,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
-
read
public T read(BlobContainer blobContainer, String name) throws IOException
Reads and parses the blob with given name, applying name translation using the {link #blobName} method- Parameters:
blobContainer- blob containername- name to be translated into- Returns:
- parsed blob object
- Throws:
IOException
-
delete
public void delete(BlobContainer blobContainer, String name) throws IOException
Deletes obj in the blob container- Throws:
IOException
-
readBlob
public T readBlob(BlobContainer blobContainer, String blobName) throws IOException
Reads blob with specified name without resolving the blobName using usingblobName(java.lang.String)method.- Parameters:
blobContainer- blob containerblobName- blob name- Throws:
IOException
-
writeAtomic
public void writeAtomic(T obj, BlobContainer blobContainer, String name) throws IOException
Writes blob in atomic manner with resolving the blob name usingblobName(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:
IOException
-
write
public void write(T obj, BlobContainer blobContainer, String name, boolean failIfAlreadyExists) throws IOException
Writes blob with resolving the blob name usingblobName(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 namefailIfAlreadyExists- Whether to fail if the blob already exists- Throws:
IOException
-
-