\Drupal\strata\Archive ArchiveManifest

What an archive holds, and what it is missing.

An archive is only useful if it can be restored somewhere else, so the manifest exists to answer one question before anything is unpacked: is this self-contained? The three lists it carries are the three reachability classes - commits, the frames they resolve through, and the dictionaries and delta anchors those frames decode against. An archive missing any one of them holds bytes that cannot be read, which is worse than holding nothing, because it looks like a backup.

problems is the honest field. An export that could not read an object records it here rather than omitting it silently, and isComplete() is false for the rest of the archive's life.

Summary

Methods
Properties
Constants
__construct
isComplete
count
summary
jsonSerialize
fromArray
site
createdAt
commits
frames
dictionaries
objects
bytes
problems
head
version
VERSION
FILE
No protected methods found
No protected properties found
No protected constants found
strings
formatBytes
No private properties found
No private constants found

Constant

VERSION

VERSION = 1

The manifest format, so an archive from a later release is refused rather than misread.

FILE

FILE = 'strata-manifest.json'

The file the manifest lives in inside the archive.

Properties

$site

$site : string

Type

string

$createdAt

$createdAt : int

Type

int

$commits

$commits : array

Type

array<string|int, mixed>

$frames

$frames : array

Type

array<string|int, mixed>

$dictionaries

$dictionaries : array

Type

array<string|int, mixed>

$objects

$objects : array

Type

array<string|int, mixed>

$bytes

$bytes : int

Type

int

$problems

$problems : array

Type

array<string|int, mixed>

$head

$head : ?string

Type

string|null

$version

$version : int

Type

int

Methods

__construct()

__construct(string  $site, int  $createdAt, list  $commits = [], list  $frames = [], list  $dictionaries = [], list  $objects = [], int  $bytes = 0, list  $problems = [], string|null  $head = null, int  $version = \self::VERSION) : mixed

Constructs a manifest.

Parameters

string $site

The site id the history was exported from.

int $createdAt

Unix seconds the archive was written.

list $commits

Commit ids the archive carries, oldest first.

list $frames

Frame content addresses the archive carries.

list $dictionaries

Dictionary ids the archive carries.

list $objects

Every object key in the archive, so an import needs no directory walk.

int $bytes

Bytes of stored objects, not counting the archive's own framing.

list $problems

What could not be read, one line each.

string|null $head

The commit the exported ref pointed at, or NULL when no ref was exported.

int $version

The manifest format version.

Returns

mixed —

isComplete()

isComplete() : bool

Whether everything the archive references is inside it.

Returns

bool —

TRUE when nothing was recorded as missing.

count()

count() : int

How many objects the archive holds.

Returns

int —

The count.

summary()

summary() : string

A one-line summary for a command line or a log.

Returns

string —

What the archive holds.

jsonSerialize()

jsonSerialize() : array

{@inheritdoc}

Returns

array —

fromArray()

fromArray(array  $data) : self

Rebuilds a manifest from what an archive carries.

Parameters

array $data

The decoded manifest file.

Returns

self —

The manifest.

strings()

strings(mixed  $value) : list<string>

Reduces a decoded value to a list of strings.

Parameters

mixed $value

The decoded value.

Returns

list

The strings it held.

formatBytes()

formatBytes(int  $bytes) : string

Renders a byte count in the largest unit that stays readable.

Parameters

int $bytes

The count.

Returns

string —

The rendered size.