\Drupal\strata\Capture TableWrites

What one table saw during one request.

The statement tap folds many statements per table into one of these, so a request writing four hundred rows to one table produces one operation rather than four hundred.

The verb it keeps is the most consequential one seen, not the last. A window holding an insert and a truncate is described by the truncate, because that is what a reader has to notice, and a structural change outranks every content change for the same reason.

Summary

Methods
Properties
Constants
from
fold
outrankedBy
fieldNames
label
jsonSerialize
realm
verb
statements
keywords
sample
No public constants found
No protected methods found
No protected properties found
No protected constants found
__construct
No private properties found
No private constants found

Properties

$realm

$realm : \Drupal\strata\Journal\Realm

Type

Realm

$verb

$verb : \Drupal\strata\Journal\Verb

Type

Verb

$statements

$statements : int

Type

int

$keywords

$keywords : array

Type

array<string|int, mixed>

$sample

$sample : string

Type

string

Methods

from()

from(\Drupal\strata\Capture\SqlStatement  $statement, string  $sample) : self

Starts a record from the first statement seen for a table.

Parameters

\Drupal\strata\Capture\SqlStatement $statement

The classified statement.

string $sample

Its shape.

Returns

self —

The record.

fold()

fold(\Drupal\strata\Capture\SqlStatement  $statement, string  $sample) : self

Folds another statement in.

Parameters

\Drupal\strata\Capture\SqlStatement $statement

The classified statement.

string $sample

Its shape, kept only when it becomes the described statement.

Returns

self —

A new record.

outrankedBy()

outrankedBy(\Drupal\strata\Capture\SqlStatement  $statement) : bool

Whether a statement is more consequential than what is recorded.

Parameters

\Drupal\strata\Capture\SqlStatement $statement

The new statement.

Returns

bool —

TRUE when it should replace the recorded realm and verb.

fieldNames()

fieldNames() : list<string>

The keywords seen, as the field names an operation records.

A statement has no fields, so the keywords are what a diff viewer can usefully list: they say whether the window inserted, updated, deleted or restructured.

Returns

list

The keywords, in first-seen order.

label()

label(string  $table) : string

The label the timeline shows.

Parameters

string $table

The table these writes were against.

Returns

string —

Something such as "3 writes to node_field_data".

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The record as the payload an operation carries.

__construct()

__construct(\Drupal\strata\Journal\Realm  $realm, \Drupal\strata\Journal\Verb  $verb, int  $statements, array  $keywords, string  $sample) : mixed

Constructs a record of one table's writes.

Parameters

\Drupal\strata\Journal\Realm $realm

Realm::TABLE for row changes, Realm::SCHEMA once anything structural has been seen.

\Drupal\strata\Journal\Verb $verb

The most consequential verb seen.

int $statements

How many statements were folded in.

array $keywords

Leading keyword keyed to how many statements began with it.

string $sample

The shape of the statement that set the current verb, safe to show in a timeline.

Returns

mixed —