\Drupal\strata\Tier TierRequirements

Works out which buckets a restore has to read before it reads any of them.

Preflight already proves what a restore can put back, and it proves it by materialising every subject - which means by the time it has an answer it has already read the cold bucket. This runs first and answers a smaller question from the placement index: which tiers hold the objects that replay is going to want. It reads the commits and the anchor chain, which are small, and looks the frames up locally rather than fetching them.

An object with no placement row is counted and never guessed at. While there is one, every tier is reported as possibly needed.

Summary

Methods
Properties
Constants
__construct
require
No public properties found
FRAME_LIMIT
No protected methods found
No protected properties found
No protected constants found
objectKeys
addAnchor
addFrame
describe
scope
router
placement
commits
bases
index
site
No private constants found

Constant

FRAME_LIMIT

FRAME_LIMIT = 5000

How many frames one walk looks up before it stops and says it was bounded.

A full anchor names every subject on the site, and the question here has at most a handful of possible answers, so reading the whole index to reach one of them is waste. The walk also stops as soon as every tier is required, because nothing further can change the answer.

Properties

$router

$router : \Drupal\strata\Tier\TieredProvider

Type

TieredProvider

$commits

$commits : \Drupal\strata\Tree\CommitLog

Type

CommitLog

$bases

$bases : \Drupal\strata\Tree\BaseReader

Type

BaseReader

$site

$site : \Drupal\strata\Site\SiteContext

Type

SiteContext

Methods

__construct()

__construct(\Drupal\strata\Tier\TieredProvider  $router, \Drupal\strata\Tier\PlacementIndexInterface  $placement, \Drupal\strata\Tree\CommitLog  $commits, \Drupal\strata\Tree\BaseReader  $bases, \Drupal\strata\Cas\FrameIndexInterface  $index, \Drupal\strata\Site\SiteContext  $site) : mixed

Constructs a requirements pass.

Parameters

\Drupal\strata\Tier\TieredProvider $router

The store, asked which tiers can be reached.

\Drupal\strata\Tier\PlacementIndexInterface $placement

Where each object is.

\Drupal\strata\Tree\CommitLog $commits

Resolves the replay path.

\Drupal\strata\Tree\BaseReader $bases

Resolves the anchor chain and the frames it names.

\Drupal\strata\Cas\FrameIndexInterface $index

Maps a frame address to the object holding it, and to its delta parent.

\Drupal\strata\Site\SiteContext $site

Applies the same key scoping the provider does, so a placement lookup uses the key the bucket actually holds.

Returns

mixed —

require()

require(string  $target, int  $limit = \self::FRAME_LIMIT) : \Drupal\strata\Tier\TierRequirementReport

Which tiers a restore to one commit needs.

Parameters

string $target

Commit id to replay to.

int $limit

Most frames to look up before the walk reports itself bounded.

Returns

\Drupal\strata\Tier\TierRequirementReport —

The answer.

objectKeys()

objectKeys(string  $target, int  $limit, list  $problems, bool  $bounded) : list<string>

Every object key a replay to a commit reads.

Parameters

string $target

Commit id.

int $limit

Most frames to resolve.

list $problems

Collects one line per object the walk could not resolve.

bool $bounded

Set to TRUE when the walk stopped early.

Returns

list

Object keys, deduplicated, scoped exactly as the bucket holds them.

addAnchor()

addAnchor(string  $anchor, array  $keys, int  $limit, int  $seen, list  $problems, bool  $bounded) : void

Adds an anchor chain and the objects holding the frames it names.

Parameters

string $anchor

Anchor address.

array $keys

Collected keys, added to by reference.

int $limit

Most frames to resolve.

int $seen

Frames resolved so far, counted across every anchor rather than per anchor.

list $problems

Collects one line per object the walk could not resolve.

bool $bounded

Set to TRUE when the walk stopped early.

Returns

void —

addFrame()

addFrame(string  $hash, array  $keys) : void

Adds the object holding one frame, and the objects holding its delta chain.

A frame the index does not know is not added at all. It would be a guess about which bucket holds an object nothing can locate, and Preflight is the pass that reports that as unrestorable.

Parameters

string $hash

Frame content address.

array $keys

Collected keys, added to by reference.

Returns

void —

describe()

describe(array  $counts) : array<int,array{name: string, objects: int, reachable: bool, reason: string|null}>

Turns per-tier object counts into the report's rows.

Parameters

array $counts

Tier index keyed to how many needed objects it holds.

Returns

array

The rows.

scope()

scope(string  $key) : string

A key as the bucket holds it.

Frames, packs, media blocks and dictionaries are shared between the sites in a bucket and carry no site prefix; everything else does. Applying the wrong rule would look up a key nothing has a placement row for and report every object as unplaced.

Parameters

string $key

The key as the engine composes it.

Returns

string —

The key as it appears in a listing.