[][src]Struct frugalos_raft::NodeId

pub struct NodeId {
    pub local_id: LocalNodeId,
    pub instance: u32,
    pub addr: SocketAddr,
}

ノードの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

ノードが存在するマシンを特定するためのアドレス.

Implementations

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 Clone for NodeId[src]

impl Copy for NodeId[src]

impl Debug for NodeId[src]

impl<'de> Deserialize<'de> for NodeId[src]

impl Display for NodeId[src]

impl Eq for NodeId[src]

impl FromStr for NodeId[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for NodeId[src]

impl PartialEq<NodeId> for NodeId[src]

impl Serialize for NodeId[src]

impl StructuralEq for NodeId[src]

impl StructuralPartialEq for NodeId[src]

Auto Trait Implementations

impl RefUnwindSafe for NodeId

impl Send for NodeId

impl Sync for NodeId

impl Unpin for NodeId

impl UnwindSafe for NodeId

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.