Commit 1d3554e6 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

peerstore: AddPeerInfo

parent 57b79033
...@@ -26,6 +26,9 @@ type Peerstore interface { ...@@ -26,6 +26,9 @@ type Peerstore interface {
// that peer, useful to other services. // that peer, useful to other services.
PeerInfo(ID) PeerInfo 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. // 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 // if we find something we use often, it should become its own set of
// methods. this is a last resort. // methods. this is a last resort.
...@@ -235,6 +238,10 @@ func (ps *peerstore) PeerInfo(p ID) PeerInfo { ...@@ -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 { func PeerInfos(ps Peerstore, peers []ID) []PeerInfo {
pi := make([]PeerInfo, len(peers)) pi := make([]PeerInfo, len(peers))
for i, p := range peers { for i, p := range peers {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment