DiskpipeSTORAGE / OPERATIONS

zccusan

zccusan means Zero Copy Cinematic Universe Storage Area Network.

It is the umbrella idiom for this repo's storage stack. The stack has a strict chain of being:

  1. descriptor zero-copy primitives;
  2. zero-copy streams;
  3. zero-copy WALs, including WALs of WALs;
  4. zcvolume abstractions;
  5. zcsan, the Zero Copy Storage Area Network layer;
  6. zccsi, the convenience Kubernetes CSI adapter.

The dependency direction only points downward. zccsi can translate Kubernetes CSI RPCs into zcsan/zccusan control calls, but CSI must not become the place where stream, WAL, volume, SAN, topology, tenant, or replication semantics live. Those belong to zccusan below it.

Shape

Block Boundary

zccusan has one custom fabric-facing block device family: /dev/zcnblk0, backed by the zcnblk wire protocol today. It is the block-speaking onramp for fio, filesystems, databases, and CSI consumers. Target-side storage is a userspace service. A target may choose ordinary files, allowlisted raw devices, or optional /dev/zcbrdN RAM media as last-hop backing, but custom zc block devices are not the place where SAN topology lives.

Mirroring, striping, forwarding, tier admission, tier spill, snapshot COW/WAL resolution, compaction placement, and replica fanin/fanout are userspace zccusan/gateway policy. Kernel block code should only expose the fabric edge or act as optional final media behind a userspace target.

zccsi Rule

The CSI driver is zccsi: an adapter. It must stay replaceable by another client that uses the same zccusan protocol.

That means CSI should:

Upgrade Rule

The zccusan protocol is versioned independently from CSI. Kubernetes CRD and CSI sidecar upgrades can stair-step through Helm-rendered manifests, but the control protocol itself must support an N-1 rollout path for agents and clients. New features should be additive in OpenAPI first, then made mandatory only after all participating agents can serve the previous version.

Durable State Logstream

zcblock-control now stores zccusan state transitions in a durable logstream. The local implementation is file-backed at $stateDir/logstream/zccusan-state.log unless --logstream-path or ZCCUSAN_LOGSTREAM_PATH is set.

Each append is a framed, checksummed, fsynced record. Records carry a monotonic sequence, byte offset, stream name, event kind, key, JSON payload, and a term field reserved for the later Raft-backed implementation. On startup the local agent replays snapshot create/delete events back into the materialized snapshot state files, so the existing file layout remains an index rather than the only source of truth.

For tests and operators, GET /v1/logstream replays the current node-local log. This is intentionally a zccusan control API, not a CSI API; CSI is just one client that causes state transitions.

Live Replication Switching

The local control API has two durable replication policy surfaces:

Both append to the durable state log before updating live in-memory stream job metadata. Route changes do not contact the old gateway endpoint, so a volume can be train-track-switched away from an unresponsive target. Today this is the control-plane contract; snapshot transfer uses the existing stream replication path, and WAL catch-up becomes real when the WAL/gateway journal primitives land.

Snapshot Devices And Compaction

Point-in-time snapshots can be registered as read-only fabric snapshot exports via POST /v1/snapshot-devices. The requested mode is explicit: cow or wal, but that mode is resolved by the userspace fabric target/gateway. There are no separate zccowsnap or zcwalsnap kernel providers, and the controller does not fall back to loop devices, copied restore volumes, or other short-term substitutes.

Snapshot compaction is tracked as a workflow, not just a local kernel command:

Bulk data stays on the zccusan stream path. The compaction endpoint is only for durable job state and operator visibility.

Replication progress is visible through two read paths:

Day-1 Monitoring

Start with one page-level question: is there anything I need to look at?

The controller computes that answer internally. For Prometheus, alert on the single label-free master signal:

zccusan_replication_attention_required == 1

If a deployment wants the minimum split without volume-level cardinality, watch zccusan_replication_attention_failed_jobs and zccusan_replication_attention_idle_jobs. The idle side uses the controller's published zccusan_replication_attention_idle_threshold_seconds value. Today that threshold is 30 seconds.

When the alert fires, fetch the single programmatic drill-down endpoint:

curl -fsS http://127.0.0.1:9788/v1/stats

Read summary first. summary.attention_required is the same master signal as the metric. summary.attention_failed_jobs and summary.attention_idle_jobs explain the broad reason. Only then drill into hierarchy.placement to find the target cluster, spillover tier, or gateway endpoint, or into hierarchy.logical to see which logical volume or snapshot replica is affected.

Helm Rule

The Helm chart is only a rendering mechanism for ordinary Kubernetes resources. There are no Helm hooks. Stair-step upgrades should work with:

helm template RELEASE zccusan/charts/zcblock-csi --namespace NAMESPACE | kubectl apply -f -
kubectl -n NAMESPACE rollout status daemonset/RELEASE-node
Built from Markdown with Rust. No client-side dependencies.