You are reading documentation for 0.8.3. The latest release in the 0.8 line is 0.8.4.

Delta Exchange Protocol

How Mammoth Cache packages, names, and exchanges per-worker cache deltas between distributed jobs.

Worker and aggregator lifecycle

  1. Worker prepare restores the base and records a cutoff after its own reads/writes.
  2. The build runs normally.
  3. Worker finalize scans metadata before its own content reads and uploads selected upserts/usage. Empty observation sets still produce completion envelopes. Workers never save the base.
  4. Aggregate prepare validates and applies selected envelopes and retains upstream activity before recording its own cutoff. Used-only paths do not recreate absent files.
  5. Aggregate finalize performs eligible GC and requires successful publication for upserts, GC removal or a nonempty miss. A successful sweep also publishes its completion timestamp. Usage alone does not require a generation. Base reuse follows observed metadata and may miss byte rewrites with identical metadata. Aggregate partitions exchange no deletion tombstones. A single-writer snapshot replaces its complete configured membership, including removals, and metadata-only changes independently require publication.

On pull-request events, read-only mode performs no exchange: workers upload nothing, and an aggregator returns skipped-read-only without listing, downloading, validating, applying, or deleting artifacts. This makes a static topology safe, but a workflow should avoid allocating the aggregator runner when it can express the writable-event condition directly.

Completion and selection

A writable distributed worker uploads one immutable archive after its build. An archive can contain an empty contribution and still confirm participation. Mammoth requires a positive upload receipt. The artifact identity binds the producer job, workflow run, attempt, source revision and compatible family. An aggregator requires the latest eligible artifact for each named worker and deduplicates repeated names. Optional snapshot writers have separate policy.

A failed or unconfirmed upload retains its immutable package at the reported path. A fresh workflow invocation follows normal producer discovery. An interrupted owner never resumes an earlier upload or publication.

Worker TAR-v3

The artifact is a gzip-compressed TAR. An aggregate channel carries changed files and complete upsert units, a usage channel carries protection facts, and isolated snapshot channels carry designated writers’ native contents. Empty directories inside selected units are explicit. Usage structure carries no file bodies. TAR headers and following file metadata establish path, size, permissions and content SHA-256. Control records between two files share one bounded member, and directories exist only as controls. Final counts, event seals and EOF close the archive.

An aggregator validates every required stream, including losing file bodies. It stages only selected payloads. Invalid ownership, inconsistent units, missing controls or incomplete framing reject the merge before live installation.

Complete workspaces and Maven directories

Gradle Groovy, Kotlin and transform workspaces travel as complete managed units. Whole-directory winner policies select one producer. The strict policy requires compatible views. The Gradle build-cache entry policy applies to qualifying task-cache archive paths.

Maven worker upserts carry the whole managed coordinate directory. Default strict merge checks complete views, including origin markers. Explicit choose-worker-directory selects one producer’s complete directory. Ordinary newest-mtime handling does not override complete-unit rules. The existing aggregator target is checked for protected artifact siblings before installation. See Maven cache internals.

Conflict handling policies

The conflict-handling partition field selects how an aggregator resolves differing worker views. See configuration for the values, defaults and supported partitions.

Gradle workspaces and build-cache entries

For Gradle DSL and transform caches, the unit is the complete hashed workspace, including its metadata, output files and empty output directories. Groovy requires both metadata files; Kotlin uses its layout-specific required outputs; transforms require nonempty metadata.bin, regular results.bin and transformed/. Conflicting producers are selected by the job-name ordering below. Losing views are discarded. The selected complete workspace replaces existing managed contents; excluded or unmanaged target obstacles fail before replacement. Partial-workspace overrides and single-writer publication are unsupported. default keeps whole-workspace transport but rejects conflicting views. See cache partitions for capture and GC.

choose-worker-entry supports aggregate Gradle build-cache partitions with includes rooted at caches/build-cache-*/ or a literal numeric format directory. It selects one unchanged archive per direct 32-lowercase-hex key under caches/build-cache-<number>/. Other filenames retain ordinary strict handling. Different keys can come from different producers. Both Gradle selection policies use the smallest producer job name in JavaScript UTF-16 ordinal order, independent of package arrival and modification times, and take precedence over allow-duplicate-dependent-delta-paths. Explicit strict overrides also take precedence for recognized workspace/archive collisions.

These policies also select a winner if actual outputs differ under the same key. They assume correctly declared, reproducible Gradle work; Mammoth does not compare archive contents semantically or rewrite origin metadata. Use default to reject such conflicts. Portable file permissions still apply to the selected view.

Maven directories

For each immediate repository directory, choose the complete contribution from the producer with the smallest job name in JavaScript UTF-16 ordinal order. Discovery first selects each producer’s newest eligible attempt. File arrival order, modification times and attempt numbers across different producers do not set priority. Differing directory membership counts as a conflict too.

The winner supplies all files and their attributes, subject to normal portable permissions. Other producers’ files for that directory are discarded. Marker contents are neither parsed nor merged. This directory policy takes precedence over allow-duplicate-dependent-delta-paths. Usage-only contributions cannot win. Directories spanning partitions must use one consistent policy; single-writer snapshot partitions cannot use this mode.

Selection can lose classifiers, origin entries or local installs supplied only by another worker. Offline builds may fail, and a discarded local install may have no remote copy. Different directories may select different workers, so this is not a snapshot of the entire Maven repository. A forwarding worker republishes its selected view under its own job identity; priority is per merge stage.

Existing aggregator files absent from the winning directory still cause an error before worker upserts, including files excluded from caching. This mode does not delete target siblings or add exact directory replacement. Diagnostics report resolved conflicts with bounded winner/discarded-producer details.

Base publication after merge

After the build, the owning base post observes the working cache. It can reuse unchanged generation refs even after incoming content validation. A change that preserves the metadata used for base comparison may be missed. Locally retained source data and required returns stay under the owning operation.

For wire details see the cache protocol. For workflow inputs and retry behavior see distributed jobs.