\Drupal\strata\Form StorageSettingsForm

Where history is written, how it is compressed, and how it is sealed.

What this form is careful about is telling the operator what the host can actually do. A codec this host has no extension and no binary for is listed as unavailable with the reason, rather than offered and then silently falling back at the first flush; the same for the journal backend and for the encryption key. A settings form that accepts a configuration the host cannot honour produces a site that looks configured and is not.

The flush interval is presented as what it is - a durability window, not a restore granularity. Operations inside a segment stay individually addressable, so a longer interval does not coarsen what a restore can target; it only decides how much is lost if the host dies before a flush.

Summary

Methods
Properties
Constants
create
getFormId
buildForm
validateForm
generateKey
submitForm
providerLabel
No public properties found
SETTINGS
settingKeys
getEditableConfigNames
fieldFor
setting
coerce
keys
keyMaker
engine
No protected constants found
validateCodec
validateKey
validateLocalPath
addDestination
addSealing
addKeyButton
addFlush
retiredKeys
providerOptions
codecOptions
journalOptions
No private properties found
No private constants found

Constant

SETTINGS

SETTINGS = 'strata.settings'

The configuration object every settings form edits.

Properties

$keys

$keys : ?\Drupal\key\KeyRepositoryInterface

The key module's repository, for checking a chosen key before the first flush needs it.

Type

KeyRepositoryInterface|null

$keyMaker

$keyMaker : ?\Drupal\strata\Crypto\KeyMaker

Makes a key entity, for the operator who has not got one yet.

Type

KeyMaker|null

$engine

$engine : ?\Drupal\strata\Engine

The engine, reset after a save.

Type

Engine|null

Methods

create()

create(\Symfony\Component\DependencyInjection\ContainerInterface  $container) : static

{@inheritdoc}

The engine is asked for, never required. composer.json PSR-4 maps Drupal\strata\ onto src/, so every class here loads off composer's autoloader whether or not the module is in core.extension, while strata.services.yml reaches the container only when it is. A router table still holding this route after the module left - a failed install, a composer remove with no uninstall - therefore resolves the class, calls this, and answered 500 with ServiceNotFoundException until 1.0.3. The property is nullable and every use of it is null-safe, so asking is the whole fix.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container

Returns

static —

getFormId()

getFormId() : string

{@inheritdoc}

Returns

string —

buildForm()

buildForm(array  $form, \Drupal\Core\Form\FormStateInterface  $form_state) : array

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

array —

validateForm()

validateForm(array  $form, \Drupal\Core\Form\FormStateInterface  $form_state) : void

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

void —

generateKey()

generateKey(array  $form, \Drupal\Core\Form\FormStateInterface  $form_state) : void

Creates a key, selects it, and retires whichever one it displaced.

Saves configuration on its own rather than deferring to the main submit, because it runs with validation limited away and the rest of the submitted values have therefore not been checked.

Parameters

array $form

The form.

\Drupal\Core\Form\FormStateInterface $form_state

The submitted values.

Returns

void —

submitForm()

submitForm(array  $form, \Drupal\Core\Form\FormStateInterface  $form_state) : void

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

void —

providerLabel()

providerLabel(string  $id) : string

A provider id as something to pick from a list.

A registry entry is a machine name, and rendering b2 beside "Local Directory" asks the operator to already know which submodule they enabled. An id from an add-on this module does not ship falls through to itself, which is the right answer for a name only its author knows.

Parameters

string $id

The provider id as it appears in configuration.

Returns

string —

What to show.

settingKeys()

settingKeys() : array<string,string>

The settings this form owns, keyed to their type.

Returns

array

Dotted config key keyed to one of "string", "int", "float" or "bool".

getEditableConfigNames()

getEditableConfigNames() : list<string>

{@inheritdoc}

Returns

list

The configuration this form edits.

fieldFor()

fieldFor(string  $key) : string

The form field a config key is edited by.

Dots are not valid in a form element name, so a nested key is rendered under a flattened one.

Parameters

string $key

The dotted config key.

Returns

string —

The form field name.

setting()

setting(string  $key, mixed  $default = null) : mixed

One current setting.

Parameters

string $key

The dotted config key.

mixed $default

What to return when nothing is configured.

Returns

mixed —

The configured value.

coerce()

coerce(mixed  $value, string  $type) : mixed

Coerces a submitted value to the type the config schema declares.

A form always submits strings, and configuration is schema-validated on save, so an integer setting handed the string "15" fails validation on a site running strictConfigSchema.

Parameters

mixed $value

The submitted value.

string $type

One of "string", "int", "float" or "bool".

Returns

mixed —

The coerced value.

validateCodec()

validateCodec(\Drupal\Core\Form\FormStateInterface  $form_state) : void

Refuses a codec this host cannot write frames with.

The select lists an unavailable codec on purpose, with its reason, because somebody looking for zstd has to be told the extension is missing rather than left wondering whether the release supports it. Listing one is not the same as accepting it: saving it leaves the flush path quietly on a different codec, and Engine::codecs() then carries a finding for a state a form could have refused outright.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state

The submitted values.

Returns

void —

validateKey()

validateKey(\Drupal\Core\Form\FormStateInterface  $form_state, string  $name) : void

Refuses a key the cipher could not seal a frame with.

A key of the wrong length passes every check the form used to make and then raises inside a queue worker at the first flush, where the only trace is a log line. The rule is the cipher's own, so it is applied by building what the cipher builds rather than by restating the length.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state

The submitted values.

string $name

The chosen key entity id.

Returns

void —

validateLocalPath()

validateLocalPath(\Drupal\Core\Form\FormStateInterface  $form_state) : void

Warns when the local directory is somewhere this site cannot write.

A warning rather than an error: an operator may be configuring a path a deployment step creates later, and refusing the save would leave the rest of the form unsaveable. What must not happen is the save looking clean and the first flush failing in a queue worker.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state

The submitted values.

Returns

void —

addDestination()

addDestination(array  $form) : void

Where objects are written.

Parameters

array $form

The form, added to by reference.

Returns

void —

addSealing()

addSealing(array  $form) : void

How a frame is compressed and sealed.

Parameters

array $form

The form, added to by reference.

Returns

void —

addKeyButton()

addKeyButton(array  $form) : void

The button that makes a key for an operator who has not got one.

Encryption ships on with no key, so the shipped state of a fresh install is a form that cannot be saved and a flush that refuses. Getting out of it means creating a key entity in another module, of the right type and the right byte length.

The same button replaces a key once one exists, and retires the outgoing one in the same step. A new key configured without retiring the old one makes every frame written before it unreadable, and nothing afterwards can tell that apart from corruption.

Parameters

array $form

The form, added to by reference.

Returns

void —

addFlush()

addFlush(array  $form) : void

When a window is sealed.

Parameters

array $form

The form, added to by reference.

Returns

void —

retiredKeys()

retiredKeys() : list<string>

The retired keys currently configured.

Returns

list

Key entity machine names.

providerOptions()

providerOptions() : array<string,string>

The providers this site can write to.

Returns

array

Provider id keyed to a label.

codecOptions()

codecOptions() : array<string,string>

The codecs this host can actually run, and why the others cannot.

An unavailable codec is listed with its reason rather than omitted, because an operator looking for zstd needs to be told the extension is missing, not left wondering whether this release supports it.

Returns

array

Codec id keyed to a label.

journalOptions()

journalOptions() : array<string,string>

The journal backends this host can use.

Returns

array

Backend id keyed to a label.