Interface ObjectStorage
ObjectStorageProvider.forBucket(String).
Not for user extension.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDelete the object with the given key.CompletionStage<akka.Done> deleteAsync(String key) Async variant ofdelete(String).Retrieve an object, returning both its metadata and full content, orOptional.empty()if no object exists for the given key.Async variant ofget(String).getMetadata(String key) Retrieve only the metadata for an object without downloading its content, orOptional.empty()if no object exists for the given key.getMetadataAsync(String key) Async variant ofgetMetadata(String).CompletionStage<Optional<akka.stream.javadsl.Source<akka.util.ByteString, akka.NotUsed>>> getStreamAsync(String key) Retrieve an object as a streaming source, orOptional.empty()if no object exists for the given key.List all objects in the bucket.listObjects(String prefix) List all objects whose keys start withprefix.akka.stream.javadsl.Source<ObjectMetadata, akka.NotUsed> List all objects in the bucket.akka.stream.javadsl.Source<ObjectMetadata, akka.NotUsed> listObjectsStream(String prefix) List all objects whose keys start withprefix.voidStore an object without an explicit content type.voidStore an object with an explicit content type.voidput(String key, akka.util.ByteString data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Store an object with an explicit content type.CompletionStage<akka.Done> Async variant ofput(String, ByteString).CompletionStage<akka.Done> Async variant ofput(String, ByteString, ContentType).CompletionStage<akka.Done> putAsync(String key, akka.util.ByteString data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Async variant ofput(String, ByteString, ContentType, Map).CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data) Store an object from a streaming source without an explicit content type.CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data, akka.http.javadsl.model.ContentType contentType) Store an object from a streaming source with an explicit content type.CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Store an object from a streaming source with an explicit content type.
-
Method Details
-
bucketName
String bucketName()- Returns:
- The logical name of the bucket this store interacts with
-
get
Retrieve an object, returning both its metadata and full content, orOptional.empty()if no object exists for the given key.Blocks the calling thread until the operation completes. Safe to call on a Loom virtual thread. For large objects prefer
getStreamAsync(String). -
put
Store an object without an explicit content type.Blocks the calling thread until the operation completes. Use
getMetadata(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- content to store
-
put
Store an object with an explicit content type.Blocks the calling thread until the operation completes. Use
getMetadata(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- content to storecontentType- MIME type of the content
-
put
void put(String key, akka.util.ByteString data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Store an object with an explicit content type.Blocks the calling thread until the operation completes. Use
getMetadata(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- content to storecontentType- MIME type of the contentmetadata- Additional metadata to store with the data
-
delete
Delete the object with the given key. Succeeds silently if the key does not exist.Blocks the calling thread until the operation completes.
-
listObjects
List all objects whose keys start withprefix. Pass an empty string to list all objects in the bucket.Be careful listing buckets with large numbers of entries, all will be collected into memory of the service.
-
listObjects
List<ObjectMetadata> listObjects()List all objects in the bucket.Be careful listing buckets with large numbers of entries, all will be collected into memory of the service.
-
getMetadata
Retrieve only the metadata for an object without downloading its content, orOptional.empty()if no object exists for the given key.Blocks the calling thread until the operation completes.
-
listObjectsStream
List all objects whose keys start withprefix. Pass an empty string to list all objects in the bucket. -
listObjectsStream
akka.stream.javadsl.Source<ObjectMetadata,akka.NotUsed> listObjectsStream()List all objects in the bucket. -
getStreamAsync
CompletionStage<Optional<akka.stream.javadsl.Source<akka.util.ByteString,akka.NotUsed>>> getStreamAsync(String key) Retrieve an object as a streaming source, orOptional.empty()if no object exists for the given key. Prefer this overget(String)for large objects that may not fit in JVM heap. UsegetMetadataAsync(String)to retrieve metadata separately if needed. -
putStreamAsync
CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data) Store an object from a streaming source without an explicit content type. UsegetMetadataAsync(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- stream of content chunks
-
putStreamAsync
CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data, akka.http.javadsl.model.ContentType contentType) Store an object from a streaming source with an explicit content type. UsegetMetadataAsync(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- stream of content chunkscontentType- MIME type of the content
-
putStreamAsync
CompletionStage<akka.Done> putStreamAsync(String key, akka.stream.javadsl.Source<akka.util.ByteString, ?> data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Store an object from a streaming source with an explicit content type. UsegetMetadataAsync(String)to retrieve metadata after the write if needed.- Parameters:
key- object key within the bucketdata- stream of content chunkscontentType- MIME type of the contentmetadata- Additional metadata to store with the data
-
getAsync
Async variant ofget(String). Returns aCompletionStagethat completes with the object, or an emptyOptionalif no object exists for the given key. -
putAsync
Async variant ofput(String, ByteString). Returns aCompletionStagethat completes when the object has been stored. -
putAsync
CompletionStage<akka.Done> putAsync(String key, akka.util.ByteString data, akka.http.javadsl.model.ContentType contentType) Async variant ofput(String, ByteString, ContentType). Returns aCompletionStagethat completes when the object has been stored. -
putAsync
CompletionStage<akka.Done> putAsync(String key, akka.util.ByteString data, akka.http.javadsl.model.ContentType contentType, Map<String, String> metadata) Async variant ofput(String, ByteString, ContentType, Map). Returns aCompletionStagethat completes when the object has been stored. -
deleteAsync
Async variant ofdelete(String). Returns aCompletionStagethat completes when the object has been deleted. -
getMetadataAsync
Async variant ofgetMetadata(String). Returns aCompletionStagethat completes with the metadata, or an emptyOptionalif no object exists for the given key.
-