Skip to main content

HeadState

Struct HeadState 

Source
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.

See head update authority.

Fields§

§namespace_id: NamespaceId

Namespace whose live history this head governs.

§content_store_id: ContentStoreId

Immutable 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: u64

Time 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: ChangeSeq

Greatest visible logical commit sequence.

§head_commit_id: CommitId

Commit id assigned to seq, or the fixed genesis id at sequence zero.

§writer_epoch: WriterEpoch

Current 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: InodeId

First 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: NamespaceStatus

Whether the namespace is active or terminally deleted. Every head writes it, and a head that omits it fails to decode.

Implementations§

Source§

impl HeadState

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for HeadState

Source§

fn clone(&self) -> HeadState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeadState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HeadState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for HeadState

Source§

impl PartialEq for HeadState

Source§

fn eq(&self, other: &HeadState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for HeadState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for HeadState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.