pub struct SegmentIdentity {
pub database_id: [u8; 16],
pub primary_generation: u64,
pub wal_format_version: u16,
pub catalog_version: u16,
}Expand description
Segment identity metadata used to reject forked or incompatible histories.
Fields§
§database_id: [u8; 16]§primary_generation: u64§wal_format_version: u16§catalog_version: u16Implementations§
Source§impl SegmentIdentity
impl SegmentIdentity
Sourcepub fn current(database_id: [u8; 16], primary_generation: u64) -> Self
pub fn current(database_id: [u8; 16], primary_generation: u64) -> Self
Stamp an identity with this binary’s maximum supported catalog version.
Use this at consumer sites that want “the newest catalog format this
binary can read” as the expected identity. Producers that publish
segments must instead stamp the database’s active catalog version with
Self::with_catalog_version, so a database that has not yet activated
v6 keeps stamping v5 (old-replica compatibility).
Sourcepub fn with_catalog_version(
database_id: [u8; 16],
primary_generation: u64,
catalog_version: u16,
) -> Self
pub fn with_catalog_version( database_id: [u8; 16], primary_generation: u64, catalog_version: u16, ) -> Self
Stamp an identity with an explicit (active) catalog version.
The catalog version is a compatibility annotation, not lineage: it
records the on-disk catalog format the producing database was running
when the segment was published. It is deliberately excluded from
Self::lineage_matches; consumers accept an older annotation and
reject a newer one via [validate_identity].
Sourcepub fn lineage_matches(self, other: SegmentIdentity) -> bool
pub fn lineage_matches(self, other: SegmentIdentity) -> bool
True when the strict lineage fields (database id, primary generation,
WAL format) match. catalog_version is intentionally ignored: it is a
compatibility annotation that legitimately increases across a segment
chain when a database activates a newer catalog format mid-stream.
pub fn validate(self) -> Result<()>
Trait Implementations§
Source§impl Clone for SegmentIdentity
impl Clone for SegmentIdentity
Source§fn clone(&self) -> SegmentIdentity
fn clone(&self) -> SegmentIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more