mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-28 13:16:39 +00:00
Implement lightweight method to check is peer has update channel (#1351)
Instead of GetAllConnectedPeers that need to traverse the whole connections map in order to find one channel there.
This commit is contained in:
@@ -81,6 +81,7 @@ type MockAccountManager struct {
|
||||
SyncPeerFunc func(sync server.PeerSync) (*nbpeer.Peer, *server.NetworkMap, error)
|
||||
InviteUserFunc func(accountID string, initiatorUserID string, targetUserEmail string) error
|
||||
GetAllConnectedPeersFunc func() (map[string]struct{}, error)
|
||||
HasConnectedChannelFunc func(peerID string) bool
|
||||
GetExternalCacheManagerFunc func() server.ExternalCacheManager
|
||||
}
|
||||
|
||||
@@ -622,6 +623,14 @@ func (am *MockAccountManager) GetAllConnectedPeers() (map[string]struct{}, error
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAllConnectedPeers is not implemented")
|
||||
}
|
||||
|
||||
// HasconnectedChannel mocks HasConnectedChannel of the AccountManager interface
|
||||
func (am *MockAccountManager) HasConnectedChannel(peerID string) bool {
|
||||
if am.HasConnectedChannelFunc != nil {
|
||||
return am.HasConnectedChannelFunc(peerID)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// StoreEvent mocks StoreEvent of the AccountManager interface
|
||||
func (am *MockAccountManager) StoreEvent(initiatorID, targetID, accountID string, activityID activity.Activity, meta map[string]any) {
|
||||
if am.StoreEventFunc != nil {
|
||||
|
||||
Reference in New Issue
Block a user