Class ChecksumBlobStoreFormat<T extends ToXContent>


  • public class ChecksumBlobStoreFormat<T extends ToXContent>
    extends BlobStoreFormat<T>
    Snapshot metadata file format used in v2.0 and above
    • Field Detail

      • 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 name
        blobNameFormat - format of the blobname in String.format(java.lang.String, java.lang.Object...) format
        reader - prototype object that can deserialize T from XContent
        compress - true if the content should be compressed
        xContentType - 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 name
        blobNameFormat - format of the blobname in String.format(java.lang.String, java.lang.Object...) format
        reader - prototype object that can deserialize T from XContent
        compress - true if the content should be compressed
    • Method Detail

      • 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 using BlobStoreFormat.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 serialized
        blobContainer - blob container
        name - 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 using BlobStoreFormat.blobName(java.lang.String) method.

        The blob will be compressed and checksum will be written if required.

        Parameters:
        obj - object to be serialized
        blobContainer - blob container
        name - 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