livery.strongroom._lifecycle¶
livery.strongroom._lifecycle ¶
The lifecycle: the pending publish, reachability, erasure.
Roots are every ref on disk, pins and pending refs included. Marking walks the structured formats by shape: a version yields its tree, parents, receipt and attachments; a tree yields its entries; anything else is a leaf. Reading a blob as a tree when its bytes happen to be one keeps more than needed and never less, which is the safe direction, and no namespace's meaning is read. Sweeping removes what marking did not reach, re-scanning pending refs immediately before deleting so a publish that began during the sweep still roots its objects. The one age rule is orphaned scratch.
An erased object becomes a tombstone under its path: the name stays valid in every tree that carries it, the bytes go, and landing it again is refused while the tombstone stands.
The functions here are the bodies of the livery.strongroom.Store methods of the same names; reach for the methods.
Classes:
| Name | Description |
|---|---|
Pending |
A publish that has begun and not yet committed. |
SweepReport |
What a sweep did. |
Functions:
| Name | Description |
|---|---|
new_pending_id |
A fresh pending ref name; the seam tests fix for a known name. |
publish_begin |
Begin a publish: root target under a pending ref before anything else. |
publish_commit |
Commit a publish: move the real ref, then drop the pending one. |
retire |
Drop a pending ref deliberately; what it named is returned. |
drop_ref |
Remove a volatile ref and its record by compare-and-swap. |
pin |
Root digest under |
unpin |
Drop |
erase |
Erase the bytes and keep the fact: a tombstone under the object's path. |
reachable_from |
Every object reachable from digest, itself included. |
children |
The objects data names, read by shape: a version, a tree, or none. |
sweep |
Mark from every ref, re-scan pending refs, remove the unreached. |
Attributes:
| Name | Type | Description |
|---|---|---|
PENDING |
The namespace of publishes that have begun and not committed. |
|
PINS |
The namespace of explicit roots. |
|
after_mark |
Callable[[], None]
|
Runs between marking and deleting. |
PENDING
module-attribute
¶
The namespace of publishes that have begun and not committed.
after_mark
module-attribute
¶
after_mark: Callable[[], None] = _after_mark
Runs between marking and deleting.
A variable, not a function, so the conformance harness can begin a publish there and put the sweep back afterwards.
Pending
dataclass
¶
SweepReport
dataclass
¶
SweepReport(reached: tuple[Digest, ...] = tuple(), removed: tuple[Digest, ...] = tuple(), scratch_removed: tuple[Path, ...] = tuple(), pending: tuple[str, ...] = tuple())
What a sweep did.
Attributes:
| Name | Type | Description |
|---|---|---|
reached |
tuple[Digest, ...]
|
every object marking reached, present or not. |
removed |
tuple[Digest, ...]
|
every object removed as unreached. |
scratch_removed |
tuple[Path, ...]
|
every scratch file removed as older than the age bound. |
pending |
tuple[str, ...]
|
the pending refs found by the re-scan immediately before deleting, every one a root. |
publish_begin ¶
Begin a publish: root target under a pending ref before anything else.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
publish_commit ¶
publish_commit(store: Store, pending_id: str, namespace: str, path: str, *, previous: Digest | None, by: Subject, receipt: Digest | None, meta: dict[str, Value] | None) -> RefRecord
Commit a publish: move the real ref, then drop the pending one.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
retire ¶
Drop a pending ref deliberately; what it named is returned.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
drop_ref ¶
Remove a volatile ref and its record by compare-and-swap.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
pin ¶
Root digest under pins/<name>, replacing an earlier pin of that name.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
unpin ¶
Drop pins/<name> under the maintenance lease; what it named is returned.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
erase ¶
erase(store: Store, digest: Digest, *, by: Subject, reason: str, receipt: Digest | None) -> Tombstone
Erase the bytes and keep the fact: a tombstone under the object's path.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
reachable_from ¶
Every object reachable from digest, itself included.
A digest that is absent or erased is yielded and not walked: a tree still names an erased entry, and availability is a fact separate from reachability.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
children ¶
The objects data names, read by shape: a version, a tree, or none.
Source code in packages/strongroom/src/livery/strongroom/_lifecycle.py
sweep ¶
sweep(store: Store, *, scratch_age: float, hook: Callable[[], None]) -> SweepReport
Mark from every ref, re-scan pending refs, remove the unreached.