\Drupal\strata\Compaction PruneReceipt

The written record of what a prune removed, and what that cost.

A prune is the only operation Strata performs that destroys a restore target, so it is the one operation that produces a document rather than a log line. The receipt exists to be read before the prune runs - in dry-run form the numbers are identical and nothing is deleted - because "this will free 4.2 GB" and "this will remove your only restore point older than a week" are the same sentence read two ways, and only one of them is the decision the operator is making.

A receipt that refused carries the reason. Nothing was removed in that case, including anything that was individually safe: a prune either completes as described or does nothing, since a partially applied prune leaves history in a state neither the receipt nor the operator describes.

Summary

Methods
Properties
Constants
__construct
refuse
wasRefused
isEmpty
keptCount
summary
jsonSerialize
applied
frames
objects
bytes
commits
kept
refused
seconds
No public constants found
No protected methods found
No protected properties found
No protected constants found
humanBytes
No private properties found
No private constants found

Properties

$applied

$applied : bool

Type

bool

$frames

$frames : array

Type

array<string|int, mixed>

$objects

$objects : array

Type

array<string|int, mixed>

$bytes

$bytes : int

Type

int

$commits

$commits : array

Type

array<string|int, mixed>

$kept

$kept : array

Type

array<string|int, mixed>

$refused

$refused : ?string

Type

string|null

$seconds

$seconds : float

Type

float

Methods

__construct()

__construct(bool  $applied = false, list  $frames = [], list  $objects = [], int  $bytes = 0, list  $commits = [], list  $kept = [], string|null  $refused = null, float  $seconds = 0.0) : mixed

Constructs a receipt.

Parameters

bool $applied

FALSE for a dry run or a refusal; TRUE when the objects were actually removed.

list $frames

Frame addresses removed.

list $objects

Object keys removed, which is fewer than the frames when frames shared a pack.

int $bytes

Stored bytes freed.

list $commits

Commit ids that stopped being restore targets.

list $kept

One line per candidate that was NOT removed, naming what held it alive. This is the half of the receipt that proves the three reachability classes were consulted.

string|null $refused

Why nothing was removed, or NULL when the prune ran.

float $seconds

How long it took.

Returns

mixed —

refuse()

refuse(string  $reason, list  $kept = []) : self

A receipt for a prune that would not run.

Parameters

string $reason

Why it refused.

list $kept

What was examined and held back.

Returns

self —

The receipt.

wasRefused()

wasRefused() : bool

Whether the prune declined to run.

Returns

bool —

TRUE when it refused.

isEmpty()

isEmpty() : bool

Whether the prune found nothing to do.

Returns

bool —

TRUE when there were no candidates.

keptCount()

keptCount() : int

How many candidates were held back by reachability.

Returns

int —

The count.

summary()

summary() : string

A one-line summary for a log entry or a command's output.

Returns

string —

The summary.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The receipt as a plain array, which is the form written to the audit log.

humanBytes()

humanBytes(int  $bytes) : string

Renders a byte count at a readable scale.

Parameters

int $bytes

The count.

Returns

string —

For example "4.2 GiB".