$journal
$journal : \Drupal\strata\Journal\JournalInterface
Records a change to one key in a key-addressed store.
State and the key-value collections are the same shape - a key, a serializable value, set and delete - and they have no events, so capture is a decorator around each store. This is the part both decorators share, kept separate so neither has to know about journals, actors or timestamps.
PayloadCodec decides how a value is encoded, because the replayer has to decode it the same way.
$journal : \Drupal\strata\Journal\JournalInterface
$scope : \Drupal\strata\Capture\CaptureScope
__construct(\Drupal\strata\Journal\JournalInterface $journal, \Drupal\strata\Capture\CaptureScope $scope, \Drupal\Core\Session\AccountProxyInterface $currentUser, \Psr\Log\LoggerInterface $logger, string $requestId = '') : mixed
Constructs a recorder.
| \Drupal\strata\Journal\JournalInterface | $journal | Where operations are appended. |
| \Drupal\strata\Capture\CaptureScope | $scope | Decides whether the realm is captured. |
| \Drupal\Core\Session\AccountProxyInterface | $currentUser | Attributes an operation to whoever caused it. |
| \Psr\Log\LoggerInterface | $logger | Records a capture that failed. |
| string | $requestId | Groups every operation captured in one request. |
covers(\Drupal\strata\Journal\Realm $realm) : bool
Whether a realm is captured at all.
Checked by a decorator before it reads the old value, since reading it is the only cost the decorator adds and there is no point paying it for a realm nobody captures.
| \Drupal\strata\Journal\Realm | $realm | The realm. |
TRUE when operations in this realm are recorded.
written(\Drupal\strata\Journal\Realm $realm, string $subject, mixed $value, bool $existed) : void
Records a value being written.
| \Drupal\strata\Journal\Realm | $realm | Realm::STATE or Realm::KEY_VALUE. |
| string | $subject | The subject key: a state key, or |
| mixed | $value | The value written. |
| bool | $existed | Whether the key held a value before, which decides create against update. |
renamed(\Drupal\strata\Journal\Realm $realm, string $from, string $to, mixed $value) : void
Records a key being renamed.
Recorded as a write of the new key plus a delete of the old, so a restore walking forward produces one key rather than two.
| \Drupal\strata\Journal\Realm | $realm | Realm::KEY_VALUE, the only store that renames. |
| string | $from | The subject key it moved from. |
| string | $to | The subject key it moved to. |
| mixed | $value | The value that moved. |
record(\Drupal\strata\Journal\Realm $realm, string $subject, \Drupal\strata\Journal\Verb $verb, mixed $value, bool $hasValue, string|null $from = null) : void
Appends one operation.
The value is encoded inside the try, not passed in already encoded, because PayloadCodec refuses a value JSON cannot represent and a refusal thrown from the argument list would escape past this catch and break the write that caused the capture.
| \Drupal\strata\Journal\Realm | $realm | The realm. |
| string | $subject | The subject key. |
| \Drupal\strata\Journal\Verb | $verb | What happened. |
| mixed | $value | The value written, ignored when $hasValue is FALSE. |
| bool | $hasValue | FALSE for a delete, which carries no payload. |
| string|null | $from | The key it was renamed from, or NULL. |