Class StagingArea

  • All Implemented Interfaces:

    
    public final class StagingArea
    
                        

    Staged, atomically-published writes (HEL-236 guarantee 2). Object storage has NO atomic rename, so atomicity is constructed from the primitives it does have:

    • every artifact is first written under a run-scoped STAGING prefix (<prefix>/.staging/<runId>/…) that readers never look at;

    • staged objects are server-side COPIED to their run-scoped final keys — still invisible, because readers only trust manifests;

    • the manifest is PUT with WriteCondition.IfAbsent — this single conditional create IS the commit point: before it, the dataset does not exist; after it, it is complete (the manifest names every part);

    • staging is deleted.

    A crash anywhere before step 3 leaves only invisible garbage, never a half-published dataset. Losing the step-3 race (PreconditionFailedException) rolls back this run's copies deterministically. Abandoned staging has a DETERMINISTIC ownership/cleanup rule: a run owns .staging/<runId>/, and cleanupAbandoned deletes any run whose newest object is older than the caller's threshold (a live writer keeps its staging young by writing).

    Requires StorageCapability.CONDITIONAL_CREATE; the constructor rejects a provider without it BEFORE any data movement.