\Drupal\strata\Tier PlacementIndexInterface

Remembers which tier holds which object.

Without it a read has to guess, and guessing costs one request per tier before the right one is found. With it a read of a known object costs exactly what an untiered read costs.

Everything here is derived from the buckets and is rebuilt by TierPlacementRebuilder, which is what makes it safe for an uninstall to drop the table. A miss is therefore not a failure: it means the router has to probe, and it records what it finds so the next read is cheap again.

Summary

Methods
Constants
get()
record()
place()
displace()
forget()
keysIn()
page()
clear()
byTier()
statistics()
No public constants found

Methods

get()

get(string  $key) : \Drupal\strata\Tier\Placement|null

Where one object is.

Parameters

string $key

The object key.

Returns

\Drupal\strata\Tier\Placement|null —

The placement, or NULL when nothing has been recorded for that key. NULL means unknown, not absent; Placement::isEmpty() is what says every tier was asked and none had it.

record()

record(\Drupal\strata\Tier\Placement  $placement) : \Drupal\strata\Tier\Placement

Replaces what is known about one object.

Parameters

\Drupal\strata\Tier\Placement $placement

The placement. Tiers not named by it are removed, so this is how a rebuild writes an authoritative answer over a stale one.

Returns

\Drupal\strata\Tier\Placement —

The stored placement.

place()

place(string  $key, int  $tier, int  $bytes = 0) : \Drupal\strata\Tier\Placement

Adds one tier to what is known about an object.

Parameters

string $key

The object key.

int $tier

Tier index that holds it.

int $bytes

The object's size, or zero to keep whatever is recorded.

Returns

\Drupal\strata\Tier\Placement —

The resulting placement.

displace()

displace(string  $key, int  $tier) : \Drupal\strata\Tier\Placement

Removes one tier from what is known about an object.

Parameters

string $key

The object key.

int $tier

Tier index that no longer holds it.

Returns

\Drupal\strata\Tier\Placement —

The resulting placement, empty when that was the last tier holding it.

forget()

forget(list  $keys) : int

Forgets objects entirely.

Parameters

list $keys

Object keys.

Returns

int —

How many rows were removed.

keysIn()

keysIn(int  $tier, int  $limit = 1000, int  $offset = 0) : list<string>

Object keys one tier holds, in key order.

Parameters

int $tier

Tier index.

int $limit

Most keys to return.

int $offset

Keys to skip.

Returns

list

The keys.

page()

page(int  $limit = 1000, int  $offset = 0) : list<\Drupal\strata\Tier\Placement>

One page of every placement, in key order.

Parameters

int $limit

Most placements to return.

int $offset

Placements to skip.

Returns

list<\Drupal\strata\Tier\Placement> —

The page, empty once the offset is past the end.

clear()

clear() : int

Drops every row.

Used by TierPlacementRebuilder, which lists every tier and must not inherit a row for an object that has moved.

Returns

int —

How many rows were removed.

byTier()

byTier() : array<int,array{objects: int, bytes: int}>

What each tier holds.

Returns

array

Tier index keyed to how many objects it holds and how many bytes they occupy. A tier with nothing recorded is absent, so a report drawn from this shows the tiers in use.

statistics()

statistics() : array{objects: int, copies: int, bytes: int}

How many distinct objects and rows are held.

Returns

array{objects: int, copies: int, bytes: int} —

Distinct object keys, total placements across every tier, and the byte total counted once per object rather than once per copy.