# Gossip related configuration gossip:# Bootstrap set to initialize gossip with bootstrap:127.0.0.1:7051複製代碼
Fabric節點發現與成員管理流程以下圖所示: ide
2. 網絡鏈接層次的節點成員管理(在線,掉線)
在線節點(Peer)經過持續不斷地廣播「活着」的消息,來代表他們的可用性。ui
這一部分至關於心跳檢測,若是節點離線,就在channel成員列表中刪除節點。this
3. 相關消息定義
// AliveMessage is sent to inform remote peers// of a peer's existence and activitymessageAliveMessage{
Member membership = 1;
PeerTime timestamp = 2;
bytes identity = 4;
}
// MembershipRequest is used to ask membership information// from a remote peermessageMembershipRequest{
Envelope self_information = 1;
repeatedbytes known = 2;
}
// MembershipResponse is used for replying to MembershipRequestsmessageMembershipResponse{
repeated Envelope alive = 1;
repeated Envelope dead = 2;
}
複製代碼
/* PullEngine is an object that performs pull-based gossip, and maintains an internal state of items identified by string numbers. The protocol is as follows: 1) The Initiator sends a Hello message with a specific NONCE to a set of remote peers. 2) Each remote peer responds with a digest of its messages and returns that NONCE. 3) The initiator checks the validity of the NONCEs received, aggregates the digests, and crafts a request containing specific item ids it wants to receive from each remote peer and then sends each request to its corresponding peer. 4) Each peer sends back the response containing the items requested, if it still holds them and the NONCE. Other peer Initiator O <-------- Hello <NONCE> ------------------------- O /|\ --------- Digest <[3,5,8, 10...], NONCE> --------> /|\ | <-------- Request <[3,8], NONCE> ----------------- | / \ --------- Response <[item3, item8], NONCE>-------> / \ */複製代碼
4. pull相關消息定義
// GossipHello is the message that is used for the peer to initiate// a pull round with another peermessageGossipHello{
uint64 nonce = 1;
bytes metadata = 2;
PullMsgType msg_type = 3;
}
// DataDigest is the message sent from the receiver peer// to the initator peer and contains the data items it hasmessageDataDigest{
uint64 nonce = 1;
repeatedbytes digests = 2; // Maybe change this to bitmap later on
PullMsgType msg_type = 3;
}
// DataRequest is a message used for a peer to request// certain data blocks from a remote peermessageDataRequest{
uint64 nonce = 1;
repeatedbytes digests = 2;
PullMsgType msg_type = 3;
}
// DataUpdate is the final message in the pull phase// sent from the receiver to the initiatormessageDataUpdate{
uint64 nonce = 1;
repeated Envelope data = 2;
PullMsgType msg_type = 3;
}
複製代碼