Skip to main content

ChangeRecord

Struct ChangeRecord 

Source
pub struct ChangeRecord {
    pub term: u64,
    pub lsn: u64,
    pub timestamp: u64,
    pub operation: ChangeOperation,
    pub collection: String,
    pub entity_id: u64,
    pub entity_kind: String,
    pub entity_bytes: Option<Vec<u8>>,
    pub metadata: Option<Value>,
    pub refresh_records: Option<Vec<Vec<u8>>>,
    pub range_id: Option<u64>,
    pub ownership_epoch: Option<u64>,
}

Fields§

§term: u64§lsn: u64§timestamp: u64§operation: ChangeOperation§collection: String§entity_id: u64§entity_kind: String§entity_bytes: Option<Vec<u8>>§metadata: Option<Value>§refresh_records: Option<Vec<Vec<u8>>>§range_id: Option<u64>

Issue #991 — stable identity of the range this user-data change belongs to (RangeId, from the #989 ownership catalog), or None for records that predate range replication. Carried so replicas and recovery can route a change to its range and gate it against that range’s authority watermark.

§ownership_epoch: Option<u64>

Issue #991 — the owning range’s OwnershipEpoch at the moment this change was produced. The epoch bumps only when write authority moves to a new owner, so a record whose epoch is behind the target range’s accepted epoch is a write from a deposed owner and is fenced. None for legacy records and non-range-replicated changes.

Implementations§

Source§

impl ChangeRecord

Source

pub fn for_refresh( lsn: u64, timestamp: u64, collection: impl Into<String>, records: Vec<Vec<u8>>, ) -> Self

Source

pub fn with_range_authority(self, range_id: u64, ownership_epoch: u64) -> Self

Stamp this record with the authority metadata of the range that owns it (issue #991): the stable range identity and the owner’s current ownership epoch. The term is set independently via Self::with_term.

Source

pub fn to_json_value(&self) -> JsonValue

Source

pub fn encode(&self) -> Vec<u8>

Source

pub fn with_term(self, term: u64) -> Self

Source

pub fn decode(bytes: &[u8]) -> Result<Self, String>

Trait Implementations§

Source§

impl Clone for ChangeRecord

Source§

fn clone(&self) -> ChangeRecord

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 ChangeRecord

Source§

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

Formats the value using the given formatter. Read more

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