DEFAULT_LIMIT
DEFAULT_LIMIT = 500
Commits one export walks when no limit is given.
An archive is a file someone downloads, so the default is bounded. --limit=0 lifts it.
Writes a span of history into one portable file.
The archive is the bucket's own layout, tarred - object keys become paths inside the tar, so an import is a copy rather than a translation, and a human can open one and read it with no tooling.
What makes it self-contained is the closure, not the commits. A commit resolves through a base anchor, an anchor names frames, a frame may be a delta against a parent frame and may need a dictionary to decompress. Exporting only the commits would produce an archive that unpacks cleanly and restores nothing. So each commit pulls in its whole chain of anchors, every frame those anchors and segments reference, every delta parent up the chain, and every dictionary any of those frames names.
A frame that lives inside a pack pulls the whole pack, which carries frames belonging to other commits too. That costs archive size and buys correctness: a pack is one object, and slicing one frame out of it would mean rewriting the pack index.
$provider : \Drupal\strata\Storage\StorageProviderInterface
$commits : \Drupal\strata\Tree\CommitLog
$refs : \Drupal\strata\Tree\RefStore
$segments : \Drupal\strata\Segment\SegmentReader
$bases : \Drupal\strata\Tree\BaseReader
$index : \Drupal\strata\Cas\FrameIndexInterface
$dictionaries : \Drupal\strata\Codec\Dictionary\DictionaryStore
$site : \Drupal\strata\Site\SiteContext
__construct(\Drupal\strata\Storage\StorageProviderInterface $provider, \Drupal\strata\Tree\CommitLog $commits, \Drupal\strata\Tree\RefStore $refs, \Drupal\strata\Segment\SegmentReader $segments, \Drupal\strata\Tree\BaseReader $bases, \Drupal\strata\Cas\FrameIndexInterface $index, \Drupal\strata\Codec\Dictionary\DictionaryStore $dictionaries, \Drupal\strata\Site\SiteContext $site, \Drupal\Component\Datetime\TimeInterface $time, \Psr\Log\LoggerInterface $logger) : mixed
Constructs an exporter.
| \Drupal\strata\Storage\StorageProviderInterface | $provider | Where the objects are read from. |
| \Drupal\strata\Tree\CommitLog | $commits | Walks the history. |
| \Drupal\strata\Tree\RefStore | $refs | Names the head the export starts from. |
| \Drupal\strata\Segment\SegmentReader | $segments | Reads which frames a segment references. |
| \Drupal\strata\Tree\BaseReader | $bases | Reads which frames an anchor references. |
| \Drupal\strata\Cas\FrameIndexInterface | $index | Resolves a frame to the object it lives in, and to its delta parent. |
| \Drupal\strata\Codec\Dictionary\DictionaryStore | $dictionaries | Resolves a dictionary id to its object key. |
| \Drupal\strata\Site\SiteContext | $site | Names the site in the manifest. |
| \Drupal\Component\Datetime\TimeInterface | $time | Stamps the manifest. |
| \Psr\Log\LoggerInterface | $logger | Records what the export could not read. |
export(string $path, string|null $fromCommit = null, int|null $limit = null) : \Drupal\strata\Archive\ArchiveManifest
Writes an archive.
| string | $path | Where to write. A |
| string|null | $fromCommit | Commit to walk back from, or NULL for the current head. |
| int|null | $limit | Commits to include, or NULL for the default; 0 for every commit. |
When the archive file cannot be created, or the history is empty.
What was written.
closure(string $head, int $limit = \self::DEFAULT_LIMIT) : array<string,list<string>>
Everything an archive needs to be restorable on its own.
| string | $head | Commit to walk back from. |
| int | $limit | Commits to include, or 0 for every commit. |
Keys commits, frames, dictionaries, objects and problems, each holding a list of
strings.
segmentFrames(\Drupal\strata\Tree\Commit $commit, array$objects, list $problems) : list<string>
Frames a commit's segment references, adding the segment object itself.
| \Drupal\strata\Tree\Commit | $commit | The commit. |
| array |
$objects | Object keys collected so far, added to by reference. |
| list |
$problems | Problems collected so far, added to by reference. |
Frame addresses.
anchorChain(string $address, array$anchors, array $objects, list $problems) : list<string>
Frames the whole anchor chain behind an address references.
A commit between two anchors names the anchor in force, so several commits share one chain and it is walked once.
| string | $address | The anchor address the commit names, or an empty string. |
| array |
$anchors | Anchor addresses already walked, added to by reference. |
| array |
$objects | Object keys collected so far, added to by reference. |
| list |
$problems | Problems collected so far, added to by reference. |
Frame addresses.
frameObjects(list$hashes, list $problems) : array{frames: list<string>, objects: list<string>, dictionaries: list<string>}
Resolves frames to the objects that hold them, following every delta chain to its anchor.
| list |
$hashes | Frame addresses the commits reference directly. |
| list |
$problems | Problems collected so far, added to by reference. |
Every frame including chain parents, the objects holding them, and the dictionaries they decode against.
read(string $key, list$problems) : string|null
Reads one object, recording rather than throwing when it is gone.
| string | $key | The object key. |
| list |
$problems | Problems collected so far, added to by reference. |
The bytes, or NULL when the object could not be read.