Class RebuildPass

java.lang.Object
build.jenesis.repository.walk.RebuildPass

public final class RebuildPass extends Object
The shared rebuild pass: one walk over the pointer roots feeding every WalkConsumer - so N metadata rebuilders never mean N tree walks. This is the walk half of the two-route derived-metadata contract made runnable: a scheduled surface resolves the walk, gathers WalkConsumer.discovered() and calls run(ArtifactWalk, ArtifactStore, List, List) on a cadence; steady-state freshness stays with the publication events (PublicationObserver.onPublished / onDeleted), and this pass is the first-activation back-fill, the periodic refresh and the self-heal - a consumer enabled late rebuilds its whole view from it.

What a consumer is handed. Every leaf under the walked roots that is a serving pointer - a small object naming a lower-case SHA-256 - is delivered as one WalkConsumer.onRetained(ArtifactDescriptor, ArtifactStore) call with the descriptor richness this neutral site has: under the free core's own publish/ namespace the descriptor's path is the serving request path (exactly what onPublished / onDeleted carry); under any other pointer root (a format's own blobs-namespace keys) the path is the raw store key, whose layout only the owning format knows - a coordinate-needing consumer describes it through its format. The blob hash is always set; the size is the stored blob's, or -1 for a pointer whose blob is missing - delivered, not skipped, so a reconcile consumer sees exactly the torn state it exists to repair. A leaf that names no hash (a sidecar row, a marker, an index) is never delivered.

Delivery and failure. The walk's contract carries over: every retained pointer is delivered exactly once per pass, and at least once for the uncommitted stride tail after a crash-resume - consumers are idempotent. A consumer failure propagates and stops this worker's segment with its claim left to expire; the pass then resumes from the last committed cursor, so a failure delays a rebuild but never silently truncates it - a stuck pass is visible through ArtifactWalk.pass(ArtifactStore, String) / ArtifactWalk.segments(ArtifactStore, String), never a quietly-incomplete view served as whole. WalkConsumer.onPassStarted(WalkPass) fires on this worker before its first delivery (and before onPassCompleted on an empty store - a rebuild from an empty truth is still a rebuild); WalkConsumer.onPassCompleted(WalkPass) fires when this worker observed the pass complete. The hooks are per-worker: with one scheduled worker driving the pass - the default - a snapshot rebuilder sees the whole pass between its hooks, while a deployment that fans run across threads or nodes keeps every streaming consumer correct but must not drive a snapshot rebuilder this way (its accumulation would span workers) - the degrade-and-say-so each such consumer records.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The pass-state scope every joiner shares (walks/rebuild/...) - one pass, however many workers.
  • Method Summary

    Modifier and Type
    Method
    Description
    run(ArtifactWalk walk, build.jenesis.repository.store.ArtifactStore store, List<String> pointerRoots, List<WalkConsumer> consumers)
    Join the shared rebuild pass over pointerRoots (the free publish namespace plus every blobs-namespace root the caller's installed formats declare) and stream every retained pointer to every one of consumers; empty when there is no consumer to feed - nothing is enumerated and no pass state is touched.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CONSUMER

      public static final String CONSUMER
      The pass-state scope every joiner shares (walks/rebuild/...) - one pass, however many workers.
      See Also:
  • Method Details

    • run

      public static Optional<WalkPass> run(ArtifactWalk walk, build.jenesis.repository.store.ArtifactStore store, List<String> pointerRoots, List<WalkConsumer> consumers) throws IOException
      Join the shared rebuild pass over pointerRoots (the free publish namespace plus every blobs-namespace root the caller's installed formats declare) and stream every retained pointer to every one of consumers; empty when there is no consumer to feed - nothing is enumerated and no pass state is touched. Returns the pass as this worker last saw it: COMPLETE when it just finished, ACTIVE while other holders still own segments - re-invoke on the next cadence, or let another node finish.
      Throws:
      IOException