[−][src]Struct frugalos_raft::NodeId
ノードのID.
Examples
文字列形式との相互変換.
文字列形式: {local_id:16進数}.{instance:16進数}@{addr:IPアドレス表記}
use frugalos_raft::NodeId; let id = NodeId { local_id: "1".parse().unwrap(), instance: 2, addr: "127.0.0.1:80".parse().unwrap() }; assert_eq!(id.to_string(), "1.2@127.0.0.1:80"); assert_eq!("1.2@127.0.0.1:80".parse::<NodeId>().unwrap(), id);
Fields
local_id: LocalNodeId
addr
が示すマシン内でのノードのID.
instance: u32
ノードのインスタンスを識別するためのフィールド.
例えば、ストレージデータ破損を跨いだノード再起動の際には、
このフィールドの値を変えることで、Raft(i.e., raftlog
)レベルでは、
異なるノードとして認識されるので、データ消去に伴う問題を避けることができる.
addr: SocketAddr
ノードが存在するマシンを特定するためのアドレス.
Methods
impl NodeId
[src]
pub fn to_raft_node_id(&self) -> RaftNodeId
[src]
Raft用のノードID形式に変換する.
pub fn from_raft_node_id(id: &RaftNodeId) -> Result<Self>
[src]
Raft用のノードIDをNodeId
形式に変換する.
Trait Implementations
impl Eq for NodeId
[src]
impl Copy for NodeId
[src]
impl PartialEq<NodeId> for NodeId
[src]
impl Clone for NodeId
[src]
fn clone(&self) -> NodeId
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Display for NodeId
[src]
impl Debug for NodeId
[src]
impl Hash for NodeId
[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,
Feeds a slice of this type into the given [Hasher
]. Read more
impl FromStr for NodeId
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self>
[src]
impl Serialize for NodeId
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for NodeId
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,