Package org.mockserver.blob.gcs
Class GcsBlobStore
java.lang.Object
org.mockserver.blob.gcs.GcsBlobStore
- All Implemented Interfaces:
AutoCloseable,BlobStore
BlobStore implementation backed by Google Cloud Storage.
Blob keys are mapped to GCS object names with an optional
configurable prefix.
Metadata is stored as GCS object metadata (custom key-value pairs on the object itself).
Thread-safety: Storage is thread-safe; this class adds no
mutable state beyond the injected client and configuration.
-
Constructor Summary
ConstructorsConstructorDescriptionGcsBlobStore(com.google.cloud.storage.Storage storage, String bucket, String keyPrefix) Creates a GCS blob store. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlying GCSStorageclient, releasing its HTTP transport resources.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.
-
Constructor Details
-
GcsBlobStore
Creates a GCS blob store.- Parameters:
storage- the GCS storage client (caller owns lifecycle)bucket- the GCS bucket namekeyPrefix- optional key prefix; empty string for no prefix
-
-
Method Details
-
put
Description copied from interface:BlobStoreStores a blob, overwriting any existing blob with the same key. -
get
Description copied from interface:BlobStoreRetrieves a blob by key. -
list
Description copied from interface:BlobStoreLists all blob keys that start with the given prefix. -
delete
Description copied from interface:BlobStoreDeletes a blob by key. -
close
public void close()Closes the underlying GCSStorageclient, releasing its HTTP transport resources.StorageimplementsAutoCloseable.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBlobStore
-