Documentation ¶
Overview ¶
Package gossip is a generated GoMock package.
Index ¶
- type Manager
- type MockManager
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) GossipReceived(id transport.PeerID, refs ...hash.SHA256Hash)
- func (m *MockManager) PeerConnected(peer transport.Peer)
- func (m *MockManager) PeerDisconnected(peer transport.Peer)
- func (m *MockManager) RegisterSender(arg0 SenderFunc)
- func (m *MockManager) TransactionRegistered(transaction hash.SHA256Hash)
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) GossipReceived(id interface{}, refs ...interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) PeerConnected(peer interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) PeerDisconnected(peer interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) RegisterSender(arg0 interface{}) *gomock.Call
- func (mr *MockManagerMockRecorder) TransactionRegistered(transaction interface{}) *gomock.Call
- type SenderFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // GossipReceived is to be called each time a peer sends a Gossip message. // All hashes should be removed from the peer's queue and added to the log. GossipReceived(id transport.PeerID, refs ...hash.SHA256Hash) // PeerConnected is to be called when a new peer connects. A new gossip queue will then be created for this peer. PeerConnected(peer transport.Peer) // PeerDisconnected is to be called when a peer disconnects. The gossip queue can then be cleared. PeerDisconnected(peer transport.Peer) // RegisterSender registers a sender function. The manager will call this function at set intervals to send a gossip message. // Senders should not be added after configuration. RegisterSender(SenderFunc) // TransactionRegistered is to be called when a new transaction is added to the DAG. TransactionRegistered(transaction hash.SHA256Hash) }
Manager handles changes in connections, new transactions and updates from other Gossip messages. It keeps track of transaction hashes that still have to be send to a peer in a queue. If a peer gossips a particular hash, that hash is removed from the peer queue to reduce traffic. It also keeps a small log of received hashes from a peer. When a transaction is added to the DAG but exists in that log, it won't be gossipped to that peer.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) EXPECT ¶
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) GossipReceived ¶
func (m *MockManager) GossipReceived(id transport.PeerID, refs ...hash.SHA256Hash)
GossipReceived mocks base method.
func (*MockManager) PeerConnected ¶
func (m *MockManager) PeerConnected(peer transport.Peer)
PeerConnected mocks base method.
func (*MockManager) PeerDisconnected ¶
func (m *MockManager) PeerDisconnected(peer transport.Peer)
PeerDisconnected mocks base method.
func (*MockManager) RegisterSender ¶
func (m *MockManager) RegisterSender(arg0 SenderFunc)
RegisterSender mocks base method.
func (*MockManager) TransactionRegistered ¶
func (m *MockManager) TransactionRegistered(transaction hash.SHA256Hash)
TransactionRegistered mocks base method.
type MockManagerMockRecorder ¶
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) GossipReceived ¶
func (mr *MockManagerMockRecorder) GossipReceived(id interface{}, refs ...interface{}) *gomock.Call
GossipReceived indicates an expected call of GossipReceived.
func (*MockManagerMockRecorder) PeerConnected ¶
func (mr *MockManagerMockRecorder) PeerConnected(peer interface{}) *gomock.Call
PeerConnected indicates an expected call of PeerConnected.
func (*MockManagerMockRecorder) PeerDisconnected ¶
func (mr *MockManagerMockRecorder) PeerDisconnected(peer interface{}) *gomock.Call
PeerDisconnected indicates an expected call of PeerDisconnected.
func (*MockManagerMockRecorder) RegisterSender ¶
func (mr *MockManagerMockRecorder) RegisterSender(arg0 interface{}) *gomock.Call
RegisterSender indicates an expected call of RegisterSender.
func (*MockManagerMockRecorder) TransactionRegistered ¶
func (mr *MockManagerMockRecorder) TransactionRegistered(transaction interface{}) *gomock.Call
TransactionRegistered indicates an expected call of TransactionRegistered.
type SenderFunc ¶
type SenderFunc func(id transport.PeerID, refs []hash.SHA256Hash) bool
SenderFunc is called from the queue ticker at the set interval. The func should send a specific network message within its body. If it's successful it'll return true. This will empty the queue for that peer. All messageSenders must succeed in order for the queue to be emptied.