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
impl ChangeRecord
pub fn for_refresh( lsn: u64, timestamp: u64, collection: impl Into<String>, records: Vec<Vec<u8>>, ) -> ChangeRecord
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.
pub fn to_json_value(&self) -> Value
pub fn encode(&self) -> Vec<u8> ⓘ
pub fn with_term(self, term: u64) -> ChangeRecord
pub fn decode(bytes: &[u8]) -> Result<ChangeRecord, String>
Trait Implementations§
Source§impl Clone for ChangeRecord
impl Clone for ChangeRecord
Source§fn clone(&self) -> ChangeRecord
fn clone(&self) -> ChangeRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ChangeRecord
impl RefUnwindSafe for ChangeRecord
impl Send for ChangeRecord
impl Sync for ChangeRecord
impl Unpin for ChangeRecord
impl UnsafeUnpin for ChangeRecord
impl UnwindSafe for ChangeRecord
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request