peerstore: AddPeerInfo
This commit is contained in:
parent
57b7903347
commit
1d3554e695
|
@ -26,6 +26,9 @@ type Peerstore interface {
|
|||
// that peer, useful to other services.
|
||||
PeerInfo(ID) PeerInfo
|
||||
|
||||
// AddPeerInfo absorbs the information listed in given PeerInfo.
|
||||
AddPeerInfo(PeerInfo)
|
||||
|
||||
// Get/Put is a simple registry for other peer-related key/value pairs.
|
||||
// if we find something we use often, it should become its own set of
|
||||
// methods. this is a last resort.
|
||||
|
@ -235,6 +238,10 @@ func (ps *peerstore) PeerInfo(p ID) PeerInfo {
|
|||
}
|
||||
}
|
||||
|
||||
func (ps *peerstore) AddPeerInfo(pi PeerInfo) {
|
||||
ps.AddAddresses(pi.ID, pi.Addrs)
|
||||
}
|
||||
|
||||
func PeerInfos(ps Peerstore, peers []ID) []PeerInfo {
|
||||
pi := make([]PeerInfo, len(peers))
|
||||
for i, p := range peers {
|
||||
|
|
Loading…
Reference in New Issue