Skip to content

Commit

Permalink
FAB-1018 MultiChannel API fabric<-->gossip
Browse files Browse the repository at this point in the history
This commit changes the API the fabric provides to the gossip layer
to conform to latest discussions.
Previously the JoinChannel message was expected to have all peers in the channel,
 now it can have only the anchor peers.
In addition, each peer needs to know in which organization
a fellow peer is, in order to know whether its safe to pass
a block to it or not via state transfer.

Change-Id: I6af5ce21a14bf6c4eaf1416aefe2877a147f15ec
Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Dec 18, 2016
1 parent f9e8f3b commit 8d53e6d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions gossip/api/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ import (
// SecurityAdvisor defines an external auxiliary object
// that provides security and identity related capabilities
type SecurityAdvisor interface {
// IsInMyOrg returns whether the given peer's certificate represents
// a peer in the invoker's organization
IsInMyOrg(PeerIdentityType) bool
// OrgByPeerIdentity returns the OrgIdentityType
// of a given peer identity
OrgByPeerIdentity(PeerIdentityType) OrgIdentityType

// Verify verifies a JoinChannelMessage, returns nil on success,
// and an error on failure
Verify(JoinChannelMessage) error


}

// ChannelNotifier is implemented by the gossip component and is used for the peer
Expand All @@ -48,13 +50,16 @@ type JoinChannelMessage interface {
// GetTimestamp returns the timestamp of the message's creation
GetTimestamp() time.Time

// Members returns all the peers that are in the channel
Members() []ChannelMember
// AnchorPeers returns all the anchor peers that are in the channel
AnchorPeers() []AnchorPeer
}

// ChannelMember is a peer's certificate and endpoint (host:port)
type ChannelMember struct {
Cert PeerIdentityType // PeerIdentityType defines the certificate of the remote peer
// AnchorPeer is an anchor peer's certificate and endpoint (host:port)
type AnchorPeer struct {
Cert PeerIdentityType // Cert defines the certificate of the remote peer
Host string // Host is the hostname/ip address of the remote peer
Port int // Port is the port the remote peer is listening on
}

// OrgIdentityType defines the identity of an organization
type OrgIdentityType []byte

0 comments on commit 8d53e6d

Please sign in to comment.