\Drupal\strata\Storage Capabilities

What one storage endpoint can actually do.

S3 compatibility is a spectrum. AWS, Cloudflare R2, MinIO, Backblaze B2, Wasabi, Ceph RGW and Garage all speak the same verbs and disagree on the details: whether a batch delete exists, whether conditional writes are honoured, which checksum headers are accepted, whether an object can be listed by version. Assuming a capability that is absent produces a failure at flush time on someone else's infrastructure; assuming its absence gives up throughput on every provider that has it.

A provider therefore probes its endpoint once and reports the answers here. Every consumer branches on this object rather than on a provider class name, so an add-on provider is not a special case in the engine.

Summary

Methods
Properties
Constants
__construct
local
maxObjectSize
canStore
requiresMultipart
partSizeFor
deleteBatchSize
with
jsonSerialize
multipart
batchDelete
conditionalWrite
rangeRead
presign
checksums
storageClasses
maxSinglePut
minPartSize
maxPartSize
maxParts
maxBatchDelete
uniformPartSize
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$multipart

$multipart : bool

Type

bool

$batchDelete

$batchDelete : bool

Type

bool

$conditionalWrite

$conditionalWrite : bool

Type

bool

$rangeRead

$rangeRead : bool

Type

bool

$presign

$presign : bool

Type

bool

$checksums

$checksums : bool

Type

bool

$storageClasses

$storageClasses : bool

Type

bool

$maxSinglePut

$maxSinglePut : int

Type

int

$minPartSize

$minPartSize : int

Type

int

$maxPartSize

$maxPartSize : int

Type

int

$maxParts

$maxParts : int

Type

int

$maxBatchDelete

$maxBatchDelete : int

Type

int

$uniformPartSize

$uniformPartSize : bool

Type

bool

Methods

__construct()

__construct(bool  $multipart = false, bool  $batchDelete = false, bool  $conditionalWrite = false, bool  $rangeRead = true, bool  $presign = false, bool  $checksums = false, bool  $storageClasses = false, int  $maxSinglePut = 5368709120, int  $minPartSize = 5242880, int  $maxPartSize = 5368709120, int  $maxParts = 10000, int  $maxBatchDelete = 1000, bool  $uniformPartSize = false) : mixed

Constructs a capability set.

Parameters

bool $multipart

Whether uploads can be split into parts. Required for objects above $maxSinglePut.

bool $batchDelete

Whether many keys can be deleted in one request. Pruning is enormously cheaper with it.

bool $conditionalWrite

Whether If-Match and If-None-Match are honoured on PutObject. Used to make a ref update safe against a concurrent writer.

bool $rangeRead

Whether a byte range can be requested. Without it a single frame cannot be read out of a pack and the whole pack must come down.

bool $presign

Whether a time-limited URL can be generated.

bool $checksums

Whether the endpoint accepts the x-amz-checksum-* family. Several S3-compatible services reject them outright, so they are sent only where they are known to work.

bool $storageClasses

Whether an infrequent-access tier can be selected per object.

int $maxSinglePut

Largest object accepted in one PutObject, in bytes.

int $minPartSize

Smallest multipart part except the last, in bytes.

int $maxPartSize

Largest multipart part, in bytes.

int $maxParts

Most parts one multipart upload may have.

int $maxBatchDelete

Most keys one batch delete may name.

bool $uniformPartSize

Whether every part except the last must be exactly the same size. R2 requires this; AWS does not.

Returns

mixed —

local()

local() : self

A capability set for a store with no remote semantics at all.

What LocalStorage and NullStorage report: everything is a single put, nothing is batched, and there is no size ceiling worth naming.

Returns

self —

The local capability set.

maxObjectSize()

maxObjectSize() : int

The largest object this endpoint can store at all.

The multipart product is saturated rather than left to overflow: the part limits come from a probe reading whatever the endpoint said, and maxPartSize * maxParts past PHP_INT_MAX becomes a float, which this return type would reject with a bare TypeError.

Returns

int —

Bytes, counting multipart when it is available; PHP_INT_MAX when the product is larger than an int can hold, which no object can reach anyway.

canStore()

canStore(int  $bytes) : bool

Whether an object of a given size can be stored here.

Parameters

int $bytes

Object size.

Returns

bool —

TRUE when it fits.

requiresMultipart()

requiresMultipart(int  $bytes) : bool

Whether an object of a given size needs to be uploaded in parts.

Parameters

int $bytes

Object size.

Returns

bool —

TRUE when a single put will not take it.

partSizeFor()

partSizeFor(int  $bytes) : int

The part size to use for an object.

Chooses the smallest part size that keeps the part count within $maxParts, rounded up to a whole mebibyte so the sizes stay uniform for endpoints that require it.

Parameters

int $bytes

Object size.

Returns

int —

Part size in bytes, never below $minPartSize or above $maxPartSize.

deleteBatchSize()

deleteBatchSize() : int

How many keys to send per batch delete.

Returns

int —

The batch size, or 1 when the endpoint has no batch delete.

with()

with(array  $overrides) : self

The same capabilities with individual flags overridden.

Probing refines an assumed set rather than replacing it, and the object is readonly.

Parameters

array $overrides

Constructor parameter names keyed to their new values. Unknown names are ignored, so a probe written against a newer version does not fatal on an older one.

Returns

self —

A new capability set.

jsonSerialize()

jsonSerialize() : array<string,bool|int>

{@inheritdoc}

Returns

array

The capability set as a plain array for the settings form.