Skip to main content

SegmentRole

Enum SegmentRole 

Source
#[repr(u8)]
pub enum SegmentRole { Core = 0, Extension = 1, Journal = 2, Index = 3, Cache = 4, Audit = 5, Shard = 6, Unclassified = 7, }
Expand description

Segment role classification.

Encoded as a 4-bit value (0-15). Currently 8 roles defined.

Variants§

§

Core = 0

Primary fixed-layout state. Must be preserved across migrations.

§

Extension = 1

Optional extension fields added in later versions.

§

Journal = 2

Append-only audit trail (Journal<T>). Can be cleared on migration.

§

Index = 3

Lookup index (SortedVec, SlotMap). Rebuildable from core data.

§

Cache = 4

Derived/computed cache. Safe to drop and rebuild.

§

Audit = 5

Immutable audit log. Locked after initialization.

§

Shard = 6

Part of a sharded collection. May be redistributed on rebalance.

§

Unclassified = 7

Unclassified segment (legacy compatibility).

Implementations§

Source§

impl SegmentRole

Source

pub const fn from_flags(flags: u16) -> Self

Decode role from segment flags (upper 4 bits).

Source

pub const fn into_flags(self, existing_flags: u16) -> u16

Encode role into segment flags (preserving lower 12 bits).

Source

pub const fn must_preserve(&self) -> bool

Whether this segment must be preserved during migration.

Source

pub const fn clearable_on_migration(&self) -> bool

Whether this segment can safely be cleared on migration.

Source

pub const fn rebuildable(&self) -> bool

Whether this segment can be rebuilt from other data.

Source

pub const fn is_append_only(&self) -> bool

Whether this segment should be append-only at runtime.

Source

pub const fn is_immutable_after_init(&self) -> bool

Whether writes to this segment should be rejected after init.

Source

pub const fn requires_migration_copy(&self) -> bool

Whether this segment’s data must be copied during migration.

Core and Audit segments contain irreplaceable state that cannot be rebuilt or cleared, their bytes must survive migration intact.

Source

pub const fn is_safe_to_drop(&self) -> bool

Whether this segment can be safely dropped (zeroed) without data loss.

Cache segments hold derived/computed values that can be rebuilt from other on-chain state. Dropping them is always safe.

Source

pub const fn should_emit_receipt(&self) -> bool

Whether mutations to this segment should generate a receipt entry.

Core, Extension, and Shard mutations are always receipt-worthy. Journal and Audit appends are also receipt-worthy. Cache and Index rebuilds typically are not.

Source

pub const fn is_operator_relevant(&self) -> bool

Whether this segment is relevant to operator dashboards and Manager output.

Core, Audit, and Journal segments carry meaningful business state. Cache and Index are derived and typically hidden from operators.

Source

pub const fn may_hold_financial_state(&self) -> bool

Whether this segment potentially holds financial state.

Core and Extension segments may contain balance/treasury fields. Other segments (Journal, Cache, Index) typically hold derived data.

Source

pub const fn name(&self) -> &'static str

Human-readable role name (for schema export and tooling).

Trait Implementations§

Source§

impl Clone for SegmentRole

Source§

fn clone(&self) -> SegmentRole

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 SegmentRole

Source§

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

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

impl PartialEq for SegmentRole

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SegmentRole

Source§

impl Eq for SegmentRole

Source§

impl StructuralPartialEq for SegmentRole

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.