Commit 3f97e7e3 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

goling: PeerId -> ID

parent f718bd6a
package bitswap
import (
"github.com/jbenet/go-ipfs/peer"
peer "github.com/jbenet/go-ipfs/peer"
)
// aliases
......@@ -11,7 +11,7 @@ type Ledger struct {
}
type BitSwap struct {
Ledgers map[peer.PeerId]*Ledger
Ledgers map[peer.ID]*Ledger
HaveList map[multihash.Multihash]*block.Block
WantList []*multihash.Multihash
}
......@@ -7,7 +7,7 @@ import (
// Identity tracks the configuration of the local node's identity.
type Identity struct {
PeerId string
PeerID string
}
// Datastore tracks the configuration of the datastore.
......
......@@ -19,8 +19,8 @@ type IpfsNode struct {
// the local node's identity
Identity *peer.Peer
// the book of other nodes (a map of Peer instances)
PeerBook *peer.PeerBook
// the map of other nodes (Peer instances)
PeerMap *peer.Map
// the local datastore
Datastore ds.Datastore
......@@ -67,7 +67,7 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
n := &IpfsNode{
Config: cfg,
PeerBook: &peer.PeerBook{},
PeerMap: &peer.Map{},
Datastore: d,
Blocks: bs,
DAG: dag,
......
......@@ -6,22 +6,22 @@ import (
mh "github.com/jbenet/go-multihash"
)
// PeerId is a byte slice representing the identity of a peer.
type PeerId mh.Multihash
// ID is a byte slice representing the identity of a peer.
type ID mh.Multihash
// PeerBook maps Key (string) : *Peer (slices are not comparable).
type PeerBook map[u.Key]*Peer
// Map maps Key (string) : *Peer (slices are not comparable).
type Map map[u.Key]*Peer
// Peer represents the identity information of an IPFS Node, including
// a PeerId, and relevant Addresses.
// ID, and relevant Addresses.
type Peer struct {
Id PeerId
ID ID
Addresses []*ma.Multiaddr
}
// Key returns the PeerId as a Key (string) for maps.
// Key returns the ID as a Key (string) for maps.
func (p *Peer) Key() u.Key {
return u.Key(p.Id)
return u.Key(p.ID)
}
// AddAddress adds the given Multiaddr address to Peer's addresses.
......
......@@ -26,7 +26,7 @@ func TestNetAddress(t *testing.T) {
return
}
p := Peer{Id: PeerId(mh)}
p := Peer{ID: ID(mh)}
p.AddAddress(tcp)
p.AddAddress(udp)
......
......@@ -23,7 +23,7 @@ type Conn struct {
Incoming *msgio.Chan
}
// ConnMap maps Keys (PeerIds) to Connections.
// ConnMap maps Keys (Peer.IDs) to Connections.
type ConnMap map[u.Key]*Conn
// Dial connects to a particular peer, over a given network
......
......@@ -20,7 +20,7 @@ func setupPeer(id string, addr string) (*peer.Peer, error) {
return nil, err
}
p := &peer.Peer{Id: peer.PeerId(mh)}
p := &peer.Peer{ID: peer.ID(mh)}
p.AddAddress(tcp)
return p, nil
}
......
......@@ -2,7 +2,6 @@ package util
import (
"bytes"
"fmt"
mh "github.com/jbenet/go-multihash"
"testing"
)
......
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