#[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
impl SegmentRole
Sourcepub const fn from_flags(flags: u16) -> Self
pub const fn from_flags(flags: u16) -> Self
Decode role from segment flags (upper 4 bits).
Sourcepub const fn into_flags(self, existing_flags: u16) -> u16
pub const fn into_flags(self, existing_flags: u16) -> u16
Encode role into segment flags (preserving lower 12 bits).
Sourcepub const fn must_preserve(&self) -> bool
pub const fn must_preserve(&self) -> bool
Whether this segment must be preserved during migration.
Sourcepub const fn clearable_on_migration(&self) -> bool
pub const fn clearable_on_migration(&self) -> bool
Whether this segment can safely be cleared on migration.
Sourcepub const fn rebuildable(&self) -> bool
pub const fn rebuildable(&self) -> bool
Whether this segment can be rebuilt from other data.
Sourcepub const fn is_append_only(&self) -> bool
pub const fn is_append_only(&self) -> bool
Whether this segment should be append-only at runtime.
Sourcepub const fn is_immutable_after_init(&self) -> bool
pub const fn is_immutable_after_init(&self) -> bool
Whether writes to this segment should be rejected after init.
Sourcepub const fn requires_migration_copy(&self) -> bool
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.
Sourcepub const fn is_safe_to_drop(&self) -> bool
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.
Sourcepub const fn should_emit_receipt(&self) -> bool
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.
Sourcepub const fn is_operator_relevant(&self) -> bool
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.
Sourcepub const fn may_hold_financial_state(&self) -> bool
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.
Trait Implementations§
Source§impl Clone for SegmentRole
impl Clone for SegmentRole
Source§fn clone(&self) -> SegmentRole
fn clone(&self) -> SegmentRole
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SegmentRole
impl Debug for SegmentRole
Source§impl PartialEq for SegmentRole
impl PartialEq for SegmentRole
Source§fn eq(&self, other: &SegmentRole) -> bool
fn eq(&self, other: &SegmentRole) -> bool
self and other values to be equal, and is used by ==.