Interface ObjectStore
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public interface ObjectStore implements AutoCloseable
Vendor-neutral object storage (HEL-236). The contract is S3-COMPATIBLE semantics — immutable whole objects under string keys, prefix listing, copy-not-rename — expressed without any provider type. Implementations: InMemoryObjectStore (reference/testing, this module) and
S3ObjectStore(pkgrovekit-storage-s3, AWS SDK v2 — MinIO and Amazon S3 tested).Provider-varying behavior is DISCOVERABLE via capabilities; workflows that need a capability call StorageCapabilities.require BEFORE moving data and fail with a typed CapabilityRejectedException (HEL-236 capability model).
NOTHING here assumes atomic rename — object storage has none. Atomicity is built from what S3 actually gives: unique staged keys, server-side copy, and a conditional (if-absent) manifest PUT as the single commit point — see StagingArea.
-
-
Method Summary
Modifier and Type Method Description abstract ObjectMetadatahead(ObjectKey key)Metadata without content, or null when the object does not exist. Booleanexists(ObjectKey key)abstract Sequence<ObjectSummary>list(String prefix, Integer pageSize)Lazily-paginated listing of every object whose key starts with prefix, in lexicographic key order. abstract PutResultput(ObjectKey key, ContentSource source, PutOptions options)Streaming single-object write. abstract ObjectContentget(ObjectKey key, GetOptions options)Streaming read. abstract Unitdelete(ObjectKey key)Idempotent delete: deleting an absent key is not an error. abstract LongdeletePrefix(String prefix)Delete every object under prefix; returns how many keys were deleted. abstract PutResultcopy(ObjectKey from, ObjectKey to, CopyOptions options)Server-side copy (no content through the client). abstract MultipartUploadstartMultipart(ObjectKey key, PutOptions options)Begin a multipart upload lifecycle (capability-gated: StorageCapability.MULTIPART_UPLOAD). Unitclose()abstract StorageCapabilitiesgetCapabilities()What THIS store/provider supports; stable for the store's lifetime. -
-
Method Detail
-
head
abstract ObjectMetadata head(ObjectKey key)
Metadata without content, or null when the object does not exist.
-
list
abstract Sequence<ObjectSummary> list(String prefix, Integer pageSize)
Lazily-paginated listing of every object whose key starts with prefix, in lexicographic key order. Consistency is whatever the provider gives — see StorageCapability.CONSISTENT_LISTING.
-
put
abstract PutResult put(ObjectKey key, ContentSource source, PutOptions options)
Streaming single-object write. The content is read ONCE from ContentSource.open and never materialized whole; ContentSource.lengthBytes must be known (unknown-length streams belong to MultipartTransfer).
A declared PutOptions.checksum is VERIFIED (server-side where the provider can, client-side otherwise) — a mismatch throws ChecksumMismatchException and never leaves a corrupt published object. PutOptions.condition gives conditional-create/update semantics; an unmet condition throws PreconditionFailedException.
-
get
abstract ObjectContent get(ObjectKey key, GetOptions options)
Streaming read. The caller OWNS the returned ObjectContent and must close it. With GetOptions.expectedChecksum (or a stored checksum and GetOptions.verifyChecksum) the stream verifies at EOF and throws ChecksumMismatchException on corruption — a short read that never reaches EOF is NOT a verification.
-
delete
abstract Unit delete(ObjectKey key)
Idempotent delete: deleting an absent key is not an error.
-
deletePrefix
abstract Long deletePrefix(String prefix)
Delete every object under prefix; returns how many keys were deleted.
-
copy
abstract PutResult copy(ObjectKey from, ObjectKey to, CopyOptions options)
Server-side copy (no content through the client). CopyOptions.condition applies to the DESTINATION where the provider supports it; note Amazon S3 itself cannot make CopyObject conditional on the destination — which is exactly why StagingArea commits via a conditional manifest PUT, never via a conditional copy.
-
startMultipart
abstract MultipartUpload startMultipart(ObjectKey key, PutOptions options)
Begin a multipart upload lifecycle (capability-gated: StorageCapability.MULTIPART_UPLOAD). Callers should prefer MultipartTransfer.upload, which adds bounded buffering/concurrency and guaranteed abort; using the raw lifecycle, the caller owns calling MultipartUpload.complete or MultipartUpload.abort — MultipartUpload.close aborts anything not completed so an incomplete upload is never leaked.
-
getCapabilities
abstract StorageCapabilities getCapabilities()
What THIS store/provider supports; stable for the store's lifetime.
-
-
-
-