Interface BlobStore

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AzureBlobStore, FilesystemBlobStore, GcsBlobStore, InfinispanBlobStore, InMemoryBlobStore, S3BlobStore

public interface BlobStore extends AutoCloseable
Binary large-object store abstraction. Used for persisted expectations, recorded cassettes, fixtures, and snapshots.

The in-memory implementation holds blobs in a ConcurrentHashMap; a filesystem implementation delegates to the existing file I/O paths; cloud implementations (S3, GCS, Azure Blob) are SPI-only for now.

Extends AutoCloseable so that cloud implementations can release their SDK client resources (connection pools, threads) on shutdown. The default close() is a no-op so in-memory and filesystem implementations need no change.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Releases any resources held by this blob store (e.g. cloud SDK client connection pools).
    boolean
    Deletes a blob by key.
    get(String key)
    Retrieves a blob by key.
    list(String prefix)
    Lists all blob keys that start with the given prefix.
    void
    put(String key, byte[] data, Map<String,String> metadata)
    Stores a blob, overwriting any existing blob with the same key.
  • Method Details

    • put

      void put(String key, byte[] data, Map<String,String> metadata)
      Stores a blob, overwriting any existing blob with the same key.
      Parameters:
      key - the blob key (e.g. a path-like string)
      data - the binary data
      metadata - optional metadata (may be empty, must not be null)
    • get

      Optional<Blob> get(String key)
      Retrieves a blob by key.
      Parameters:
      key - the blob key
      Returns:
      the blob, or empty if not present
    • list

      List<String> list(String prefix)
      Lists all blob keys that start with the given prefix.
      Parameters:
      prefix - the key prefix (e.g. "expectations/")
      Returns:
      list of matching keys
    • delete

      boolean delete(String key)
      Deletes a blob by key.
      Parameters:
      key - the blob key
      Returns:
      true if the key was present
    • close

      default void close()
      Releases any resources held by this blob store (e.g. cloud SDK client connection pools). The default implementation is a no-op, suitable for in-memory and filesystem stores.
      Specified by:
      close in interface AutoCloseable