# V2 Rust Sccache Cluster

`V2/ue/Build/Rust/v2-sccache-cluster-deployment.json` is the source of truth for
the distributed Rust compilation cache used by Maya, Neith, and V2 Rust service
workspaces. The deployment follows the sccache-dist topology documented by
Mozilla: one Linux scheduler, Linux build servers, and clients configured with
`[dist]`, token auth, and `RUSTC_WRAPPER=sccache`.

## Topology

The scheduler runs `sccache-dist scheduler --config /etc/sccache/scheduler.conf`
on `sccache-scheduler.v2-build.internal:10600`. It accepts client token auth and
server JWT auth rendered from Vault secrets. The scheduler must sit behind TLS;
tokens are never committed to the repo.

Build workers run `sccache-dist server --config /etc/sccache/server.conf` on the
Linux `rust-sccache-workers` pool. Workers keep toolchain archives under
`/var/cache/sccache/toolchains`, use the overlay builder, and require
`/usr/bin/bwrap` for sandboxed compile execution.

Clients install `V2/ue/Build/Rust/sccache-client.toml` as `SCCACHE_CONF` and set
`RUSTC_WRAPPER=sccache`. CI and developer builds use the shared S3-compatible
bucket `oshun-v2-rust-sccache` for compiled object cache storage.

## Health Gates

The Horde job publishes two required gates:

- `rust-sccache-dist-status` requires at least three connected build servers.
- `rust-sccache-hit-rate` requires a cache hit rate of at least 75 percent.

Operators should capture `sccache --dist-status` and `sccache --show-stats` into
`$(ArchiveRoot)/Rust/sccache-cluster-health.json` for each CI run. If the
scheduler is reachable but workers are absent, check worker static public
addresses, Vault-rendered JWT tokens, and direct client-to-worker routing.

## Rust Workspaces

The initial cluster coverage includes these high-churn workspaces:

- `libs/maya/engine-core/Cargo.toml`
- `libs/neith/Cargo.toml`
- `libs/neith/Cargo.toml`
- `libs/neith/assets/Cargo.toml`
- `apps/v6/Cargo.toml`
- `apps/v7/Cargo.toml`

After changing any client config, run
`sccache --stop-server && sccache --start-server` so the local client process
reloads the distributed settings.
