Package org.mockserver.state
Interface BlobStore
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AzureBlobStore,FilesystemBlobStore,GcsBlobStore,InfinispanBlobStore,InMemoryBlobStore,S3BlobStore
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 TypeMethodDescriptiondefault voidclose()Releases any resources held by this blob store (e.g. cloud SDK client connection pools).booleanDeletes a blob by key.Retrieves a blob by key.Lists all blob keys that start with the given prefix.voidStores a blob, overwriting any existing blob with the same key.
-
Method Details
-
put
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 datametadata- optional metadata (may be empty, must not be null)
-
get
Retrieves a blob by key.- Parameters:
key- the blob key- Returns:
- the blob, or empty if not present
-
list
Lists all blob keys that start with the given prefix.- Parameters:
prefix- the key prefix (e.g. "expectations/")- Returns:
- list of matching keys
-
delete
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:
closein interfaceAutoCloseable
-