\Drupal\strata\Capture\Classifier KeyspaceDiscovery

Finds out what is actually in the ephemeral keyspace, and how much of it there is.

Classification cannot be decided from a list of what Drupal ships, because the keyspace on a real site is mostly contributed: a module's own cache bin, a queue named after a feed, a lock nobody documented. So the keyspace is discovered by asking whatever holds it, grouped into patterns, and measured.

The measurement is the point. A pattern covering three keys and a pattern covering two million both need a decision, but only one of them is worth an administrator's attention, and only one of them will dominate the storage bill if it turns out to be captured. So every pattern carries its observed key count and byte total, and the admin UI sorts by the second.

Where the keys come from is left to a source, because the answer differs per site: Redis when strata_redis is installed, the cache and key-value tables otherwise. A source that fails is reported and the pass continues over the others - one unreachable backend must not stop the rest of the keyspace being described.

Summary

Methods
Properties
Constants
__construct
addSource
sourceCount
discover
No public properties found
GROWTH
No protected methods found
No protected properties found
No protected constants found
raise
sources
registry
tripwires
ledger
logger
No private constants found

Constant

GROWTH

GROWTH = 'classification.unclassified_growth'

Code raised when unclassified keys grow past what was last decided.

Properties

$sources

$sources : list<\Drupal\strata\Capture\Classifier\KeyspaceSourceInterface>

Sources the keyspace is read from.

Type

array<int, KeyspaceSourceInterface> —

$tripwires

$tripwires : \Drupal\strata\Health\TripwireRegistry

Type

TripwireRegistry

$logger

$logger : \Psr\Log\LoggerInterface

Type

LoggerInterface

Methods

__construct()

__construct(\Drupal\strata\Capture\Classifier\ClassificationRegistry  $registry, \Drupal\strata\Health\TripwireRegistry  $tripwires, \Drupal\strata\Health\HealthLedgerInterface  $ledger, \Psr\Log\LoggerInterface  $logger) : mixed

Constructs a discovery pass.

Parameters

\Drupal\strata\Capture\Classifier\ClassificationRegistry $registry

Where observations and decisions are stored.

\Drupal\strata\Health\TripwireRegistry $tripwires

Runs the growth check over the result.

\Drupal\strata\Health\HealthLedgerInterface $ledger

Where a growth finding is recorded.

\Psr\Log\LoggerInterface $logger

Records what a pass found.

Returns

mixed —

addSource()

addSource(\Drupal\strata\Capture\Classifier\KeyspaceSourceInterface  $source) : void

Adds a source of keys.

Collected from the container, so a submodule contributes one by tagging a service rather than by this class knowing what backends exist.

Parameters

\Drupal\strata\Capture\Classifier\KeyspaceSourceInterface $source

The source.

Returns

void —

sourceCount()

sourceCount() : int

How many sources are registered.

Returns

int —

The count. Zero means nothing can be discovered, which a status page reports rather than presenting an empty keyspace as a clean one.

discover()

discover(int  $limit = 10000) : \Drupal\strata\Capture\Classifier\DiscoveryReport

Walks every source and records what it holds.

Parameters

int $limit

Most keys to read from each source, so a pass over a large Redis stays bounded.

Returns

\Drupal\strata\Capture\Classifier\DiscoveryReport —

What was found.

raise()

raise(\Drupal\strata\Capture\Classifier\DiscoveryReport  $report) : void

Records a finding when too much of the keyspace is undecided.

Parameters

\Drupal\strata\Capture\Classifier\DiscoveryReport $report

What the pass found.

Returns

void —