Class BlobStoreFormat<T extends ToXContent>
- java.lang.Object
-
- org.elasticsearch.repositories.blobstore.BlobStoreFormat<T>
-
- Direct Known Subclasses:
ChecksumBlobStoreFormat
public abstract class BlobStoreFormat<T extends ToXContent> extends java.lang.Object
Base class that handles serialization of various data structures during snapshot/restore operations.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
blobNameFormat
protected NamedXContentRegistry
namedXContentRegistry
protected CheckedFunction<XContentParser,T,java.io.IOException>
reader
protected static ToXContent.Params
SNAPSHOT_ONLY_FORMAT_PARAMS
-
Constructor Summary
Constructors Modifier Constructor Description protected
BlobStoreFormat(java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
blobName(java.lang.String name)
void
delete(BlobContainer blobContainer, java.lang.String name)
Deletes obj in the blob containerboolean
exists(BlobContainer blobContainer, java.lang.String name)
Checks obj in the blob containerT
read(BlobContainer blobContainer, java.lang.String name)
Reads and parses the blob with given name, applying name translation using the {link #blobName} methodprotected T
read(BytesReference bytes)
abstract T
readBlob(BlobContainer blobContainer, java.lang.String blobName)
Reads and parses the blob with given blob name.
-
-
-
Field Detail
-
blobNameFormat
protected final java.lang.String blobNameFormat
-
reader
protected final CheckedFunction<XContentParser,T extends ToXContent,java.io.IOException> reader
-
namedXContentRegistry
protected final NamedXContentRegistry namedXContentRegistry
-
SNAPSHOT_ONLY_FORMAT_PARAMS
protected static final ToXContent.Params SNAPSHOT_ONLY_FORMAT_PARAMS
-
-
Constructor Detail
-
BlobStoreFormat
protected BlobStoreFormat(java.lang.String blobNameFormat, CheckedFunction<XContentParser,T,java.io.IOException> reader, NamedXContentRegistry namedXContentRegistry)
- Parameters:
blobNameFormat
- format of the blobname inString.format(Locale, String, Object...)
formatreader
- the prototype object that can deserialize objects with type T
-
-
Method Detail
-
readBlob
public abstract T readBlob(BlobContainer blobContainer, java.lang.String blobName) throws java.io.IOException
Reads and parses the blob with given blob name.- Parameters:
blobContainer
- blob containerblobName
- blob name- Returns:
- parsed blob object
- Throws:
java.io.IOException
-
read
public T read(BlobContainer blobContainer, java.lang.String name) throws java.io.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:
java.io.IOException
-
delete
public void delete(BlobContainer blobContainer, java.lang.String name) throws java.io.IOException
Deletes obj in the blob container- Throws:
java.io.IOException
-
exists
public boolean exists(BlobContainer blobContainer, java.lang.String name) throws java.io.IOException
Checks obj in the blob container- Throws:
java.io.IOException
-
blobName
protected java.lang.String blobName(java.lang.String name)
-
read
protected T read(BytesReference bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
-