@cryptotaxi247 / kubo / commits / 3f97e7e38

goling: PeerId -> ID

Juan Batiz-Benet committed Jul 22, 2014 at 02:28 UTC 3f97e7e385d3e9f4e3350b1a557b549b78581260
8 files changed +17 -18
bitswap/bitswap.go
+2 -2
@@ -1,7 +1,7 @@
1 package bitswap
2
3 import (
4 - "github.com/jbenet/go-ipfs/peer"
4 + peer "github.com/jbenet/go-ipfs/peer"
5 )
6
7 // aliases
@@ -11,7 +11,7 @@ type Ledger struct {
11 }
12
13 type BitSwap struct {
14 - Ledgers map[peer.PeerId]*Ledger
14 + Ledgers map[peer.ID]*Ledger
15 HaveList map[multihash.Multihash]*block.Block
16 WantList []*multihash.Multihash
17 }
config/config.go
+1 -1
@@ -7,7 +7,7 @@ import (
7
8 // Identity tracks the configuration of the local node's identity.
9 type Identity struct {
10 - PeerId string
10 + PeerID string
11 }
12
13 // Datastore tracks the configuration of the datastore.
core/core.go
+3 -3
@@ -19,8 +19,8 @@ type IpfsNode struct {
19 // the local node's identity
20 Identity *peer.Peer
21
22 - // the book of other nodes (a map of Peer instances)
23 - PeerBook *peer.PeerBook
22 + // the map of other nodes (Peer instances)
23 + PeerMap *peer.Map
24
25 // the local datastore
26 Datastore ds.Datastore
@@ -67,7 +67,7 @@ func NewIpfsNode(cfg *config.Config) (*IpfsNode, error) {
67
68 n := &IpfsNode{
69 Config: cfg,
70 - PeerBook: &peer.PeerBook{},
70 + PeerMap: &peer.Map{},
71 Datastore: d,
72 Blocks: bs,
73 DAG: dag,
peer/peer.go
+8 -8
@@ -6,22 +6,22 @@ import (
6 mh "github.com/jbenet/go-multihash"
7 )
8
9 -// PeerId is a byte slice representing the identity of a peer.
10 -type PeerId mh.Multihash
9 +// ID is a byte slice representing the identity of a peer.
10 +type ID mh.Multihash
11
12 -// PeerBook maps Key (string) : *Peer (slices are not comparable).
13 -type PeerBook map[u.Key]*Peer
12 +// Map maps Key (string) : *Peer (slices are not comparable).
13 +type Map map[u.Key]*Peer
14
15 // Peer represents the identity information of an IPFS Node, including
16 -// a PeerId, and relevant Addresses.
16 +// ID, and relevant Addresses.
17 type Peer struct {
18 - Id PeerId
18 + ID ID
19 Addresses []*ma.Multiaddr
20 }
21
22 -// Key returns the PeerId as a Key (string) for maps.
22 +// Key returns the ID as a Key (string) for maps.
23 func (p *Peer) Key() u.Key {
24 - return u.Key(p.Id)
24 + return u.Key(p.ID)
25 }
26
27 // AddAddress adds the given Multiaddr address to Peer's addresses.
peer/peer_test.go
+1 -1
@@ -26,7 +26,7 @@ func TestNetAddress(t *testing.T) {
26 return
27 }
28
29 - p := Peer{Id: PeerId(mh)}
29 + p := Peer{ID: ID(mh)}
30 p.AddAddress(tcp)
31 p.AddAddress(udp)
32
swarm/conn.go
+1 -1
@@ -23,7 +23,7 @@ type Conn struct {
23 Incoming *msgio.Chan
24 }
25
26 -// ConnMap maps Keys (PeerIds) to Connections.
26 +// ConnMap maps Keys (Peer.IDs) to Connections.
27 type ConnMap map[u.Key]*Conn
28
29 // Dial connects to a particular peer, over a given network
swarm/conn_test.go
+1 -1
@@ -20,7 +20,7 @@ func setupPeer(id string, addr string) (*peer.Peer, error) {
20 return nil, err
21 }
22
23 - p := &peer.Peer{Id: peer.PeerId(mh)}
23 + p := &peer.Peer{ID: peer.ID(mh)}
24 p.AddAddress(tcp)
25 return p, nil
26 }
util/util_test.go
-1
@@ -2,7 +2,6 @@ package util
2
3 import (
4 "bytes"
5 - "fmt"
5 mh "github.com/jbenet/go-multihash"
6 "testing"
7 )