pub struct HeadState {
pub namespace_id: NamespaceId,
pub content_store_id: ContentStoreId,
pub created_at_ms: u64,
pub fork_basis: Option<ForkBasis>,
pub seq: ChangeSeq,
pub head_commit_id: CommitId,
pub writer_epoch: WriterEpoch,
pub writer: Option<WriterBlock>,
pub next_inode_id: InodeId,
pub visible_wal_tip: Option<WalSegmentPointer>,
pub recent_segments: Vec<WalSegmentPointer>,
pub status: NamespaceStatus,
}Expand description
Carries the authoritative visibility, allocation, and fencing state of a namespace.
Fields§
§namespace_id: NamespaceIdNamespace whose live history this head governs.
content_store_id: ContentStoreIdImmutable content store in which the namespace publishes file bytes. Minted at creation; a fork target carries its source’s, sharing the content keyspace copy-on-write.
created_at_ms: u64Time the namespace was created, in Unix milliseconds. Sequence numbers determine order; this value is for display.
fork_basis: Option<ForkBasis>Provenance and pre-first-flush basis of a fork target; absent for a created namespace. Immutable for the namespace’s life.
seq: ChangeSeqGreatest visible logical commit sequence.
head_commit_id: CommitIdCommit id assigned to seq, or the fixed genesis id at sequence zero.
writer_epoch: WriterEpochCurrent fencing generation; a publisher holding any other epoch is rejected.
writer: Option<WriterBlock>Non-authoritative record of the most recent epoch acquisition.
next_inode_id: InodeIdFirst namespace-scoped inode identity available for allocation.
visible_wal_tip: Option<WalSegmentPointer>Accepted tip of the visible WAL chain, or None before the first commit.
recent_segments: Vec<WalSegmentPointer>Bounded newest-first predecessor accelerator below visible_wal_tip.
Chain links remain the only history authority — any disagreement
resolves in favor of the chain, and this array never protects anything
from GC.
An empty list is written as []. A head that omits the field fails
to decode.
status: NamespaceStatusWhether the namespace is active or terminally deleted. Every head writes it, and a head that omits it fails to decode.
Implementations§
Source§impl HeadState
impl HeadState
Sourcepub fn initial(
namespace_id: NamespaceId,
content_store_id: ContentStoreId,
created_at_ms: u64,
) -> Self
pub fn initial( namespace_id: NamespaceId, content_store_id: ContentStoreId, created_at_ms: u64, ) -> Self
Constructs the active sequence-zero head with the root inode already reserved.
Sourcepub fn ensure_successor_identity(
&self,
successor: &HeadState,
) -> Result<(), HeadIdentityDrift>
pub fn ensure_successor_identity( &self, successor: &HeadState, ) -> Result<(), HeadIdentityDrift>
Checks that successor carries this head’s immutable identity
forward verbatim.
The head is the only durable home of the namespace’s content store and fork provenance, so every publication that rewrites the head must copy them unchanged. Publishers call this before the compare-and-swap: a drifting successor is a construction bug, not a state to persist.