[−][src]Struct raftlog::log::LogPosition
ログの特定位置を識別するためのデータ構造.
Fields
prev_term: Term
一つ前のインデックスのエントリのTerm
.
index: LogIndex
この位置のインデックス.
Methods
impl LogPosition
[src]
pub fn is_newer_or_equal_than(&self, other: LogPosition) -> bool
[src]
self
がログ上で、other
と等しい、あるいは、より後方に位置している場合にtrue
が返る.
なおself
とother
が、それぞれ分岐したログ上に位置しており、
前後関係が判断できない場合にはfalse
が返される.
Examples
use raftlog::log::LogPosition; // `a`の方がインデックスが大きい let a = LogPosition { prev_term: 10.into(), index: 5.into() }; let b = LogPosition { prev_term: 10.into(), index: 3.into() }; assert!(a.is_newer_or_equal_than(b)); assert!(!b.is_newer_or_equal_than(a)); // `a`の方が`Term`が大きい let a = LogPosition { prev_term: 20.into(), index: 3.into() }; let b = LogPosition { prev_term: 10.into(), index: 3.into() }; assert!(a.is_newer_or_equal_than(b)); assert!(!b.is_newer_or_equal_than(a)); // `a`の方がインデックスは大きいが、`b`の方が`Term`は大きい // => 順序が確定できない let a = LogPosition { prev_term: 5.into(), index: 10.into() }; let b = LogPosition { prev_term: 10.into(), index: 3.into() }; assert!(!a.is_newer_or_equal_than(b)); assert!(!b.is_newer_or_equal_than(a));
Trait Implementations
impl Clone for LogPosition
[src]
fn clone(&self) -> LogPosition
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for LogPosition
[src]
impl Debug for LogPosition
[src]
impl Default for LogPosition
[src]
fn default() -> LogPosition
[src]
impl Eq for LogPosition
[src]
impl Hash for LogPosition
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<LogPosition> for LogPosition
[src]
fn eq(&self, other: &LogPosition) -> bool
[src]
fn ne(&self, other: &LogPosition) -> bool
[src]
impl StructuralEq for LogPosition
[src]
impl StructuralPartialEq for LogPosition
[src]
Auto Trait Implementations
impl RefUnwindSafe for LogPosition
impl Send for LogPosition
impl Sync for LogPosition
impl Unpin for LogPosition
impl UnwindSafe for LogPosition
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,