Cleanup Account Manager code (#1192)

* Remove unused am.AccountExists
* Remove unused am.GetPeerByKey
* Remove unused am.GetPeerByIP and account.GetPeerByIP
* Remove unused am.GroupListPeers
This commit is contained in:
Yury Gargay
2023-10-04 15:41:52 +02:00
committed by GitHub
parent 9131069d12
commit 4791e41004
7 changed files with 0 additions and 167 deletions

View File

@@ -314,29 +314,3 @@ func (am *DefaultAccountManager) GroupDeletePeer(accountID, groupID, peerID stri
return nil
}
// GroupListPeers returns list of the peers from the group
func (am *DefaultAccountManager) GroupListPeers(accountID, groupID string) ([]*Peer, error) {
unlock := am.Store.AcquireAccountLock(accountID)
defer unlock()
account, err := am.Store.GetAccount(accountID)
if err != nil {
return nil, status.Errorf(status.NotFound, "account not found")
}
group, ok := account.Groups[groupID]
if !ok {
return nil, status.Errorf(status.NotFound, "group with ID %s not found", groupID)
}
peers := make([]*Peer, 0, len(account.Groups))
for _, peerID := range group.Peers {
p, ok := account.Peers[peerID]
if ok {
peers = append(peers, p)
}
}
return peers, nil
}