Class EncryptedBlobStore

java.lang.Object
org.opensearch.common.blobstore.EncryptedBlobStore
All Implemented Interfaces:
Closeable, AutoCloseable, BlobStore

public class EncryptedBlobStore extends Object implements BlobStore
The EncryptedBlobStore is a decorator class that wraps an existing BlobStore and provides encryption and decryption capabilities for the stored data. It uses a CryptoManager to handle encryption and decryption operations based on the provided CryptoMetadata. The EncryptedBlobStore ensures that all data written to and read from the underlying BlobStore is encrypted and decrypted transparently.
  • Constructor Details

    • EncryptedBlobStore

      public EncryptedBlobStore(BlobStore blobStore, CryptoMetadata cryptoMetadata)
      Constructs an EncryptedBlobStore that wraps the provided BlobStore with encryption capabilities based on the given CryptoMetadata.
      Parameters:
      blobStore - The underlying BlobStore to be wrapped and used for storing encrypted data.
      cryptoMetadata - The CryptoMetadata containing information about the key provider and settings for encryption.
      Throws:
      CryptoRegistryException - If the CryptoManager is not found during encrypted BlobStore creation.
  • Method Details

    • blobContainer

      public BlobContainer blobContainer(BlobPath path)
      Retrieves a BlobContainer from the underlying BlobStore based on the provided BlobPath. The returned BlobContainer is wrapped in an EncryptedBlobContainer to enable transparent encryption and decryption of data.
      Specified by:
      blobContainer in interface BlobStore
      Parameters:
      path - The BlobPath specifying the location of the BlobContainer.
      Returns:
      An EncryptedBlobContainer wrapping the BlobContainer retrieved from the underlying BlobStore.
    • reload

      public void reload(RepositoryMetadata repositoryMetadata)
      Reoload blobstore metadata
      Specified by:
      reload in interface BlobStore
      Parameters:
      repositoryMetadata - new repository metadata
    • stats

      public Map<String,Long> stats()
      Retrieves statistics about the BlobStore. Delegates the call to the underlying BlobStore's stats() method.
      Specified by:
      stats in interface BlobStore
      Returns:
      A map containing statistics about the BlobStore.
    • extendedStats

      public Map<BlobStore.Metric,Map<String,Long>> extendedStats()
      Retrieves extended statistics about the BlobStore. Delegates the call to the underlying BlobStore's extendedStats() method.
      Specified by:
      extendedStats in interface BlobStore
      Returns:
      A map containing extended statistics about the BlobStore.
    • close

      public void close() throws IOException
      Closes the EncryptedBlobStore by decrementing the reference count of the CryptoManager and closing the underlying BlobStore. This ensures proper cleanup of resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - If an I/O error occurs while closing the BlobStore.