\Drupal\strata\File StorageClassPolicy

Which storage class a file block is written to.

Files are around 98% of the stored bytes on a site that captures them and get almost none of the compression benefit, so they are the one realm where the storage class is worth choosing rather than taking the default. A block is written once and read only during a restore or a verify, which is exactly the access pattern infrequent-access tiers are priced for: cheaper per byte-month, dearer per read, and a restore is rare enough for that to be the right side of the trade.

Everything else stays in the standard class. Frames, segments, anchors and commits are read by every verify pass and every replay; putting those in an infrequent tier would make the operations a backup performs routinely into the expensive ones.

A provider that does not offer classes gets no class, and the write proceeds. The class is a hint, not a requirement, and a store that ignores it is still correct.

Summary

Methods
Properties
Constants
__construct
forBlock
blockOptions
tiersBlocks
fromSettings
No public properties found
INFREQUENT
STANDARD
No protected methods found
No protected properties found
No protected constants found
No private methods found
tierBlocks
blockClass
No private constants found

Constant

INFREQUENT

INFREQUENT = 'STANDARD_IA'

The class blocks are written to when the provider supports one.

The S3 and R2 spelling. A provider using a different name takes it from configuration.

STANDARD

STANDARD = 'STANDARD'

The class everything a backup reads routinely stays in.

Properties

$tierBlocks

$tierBlocks : bool

Type

bool

$blockClass

$blockClass : string

Type

string

Methods

__construct()

__construct(bool  $tierBlocks = true, string  $blockClass = \self::INFREQUENT) : mixed

Constructs a policy.

Parameters

bool $tierBlocks

Whether file blocks go to the infrequent class at all.

string $blockClass

The class name to send for a block, so an endpoint spelling it differently still works.

Returns

mixed —

forBlock()

forBlock(\Drupal\strata\Storage\Capabilities  $capabilities) : string|null

The class one block should be written to.

Parameters

\Drupal\strata\Storage\Capabilities $capabilities

What the provider supports.

Returns

string|null —

The class name, or NULL to let the provider use its default, which is also what a provider with no class support gets.

blockOptions()

blockOptions(\Drupal\strata\Storage\Capabilities  $capabilities) : array<string,string>

The put options a block is written with.

Parameters

\Drupal\strata\Storage\Capabilities $capabilities

What the provider supports.

Returns

array

Options to hand the provider, empty when there is nothing to say.

tiersBlocks()

tiersBlocks() : bool

Whether blocks are being tiered at all.

Returns

bool —

TRUE when tiering is on.

fromSettings()

fromSettings(bool|null  $tierBlocks, string|null  $blockClass = null) : \Drupal\strata\File\StorageClassPolicy

A policy from the module's settings.

Parameters

bool|null $tierBlocks

Whether to tier, or NULL for the default.

string|null $blockClass

The class name, or NULL for the default.

Returns

\Drupal\strata\File\StorageClassPolicy —

The policy.