Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
docs: uniform comment sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Mar 3, 2020
1 parent ee95739 commit 43f10f2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion connmgr/connmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ConnManager interface {
// See notes on Protect() for more info.
Unprotect(id peer.ID, tag string) (protected bool)

// Close closes the connection manager and stops background processes
// Close closes the connection manager and stops background processes.
Close() error
}

Expand Down
2 changes: 1 addition & 1 deletion peer/addrinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func AddrInfoFromP2pAddr(m ma.Multiaddr) (*AddrInfo, error) {
return info, nil
}

// AddrInfoToP2pAddr converts an AddrInfo to a list of Multiaddrs.
// AddrInfoToP2pAddrs converts an AddrInfo to a list of Multiaddrs.
func AddrInfoToP2pAddrs(pi *AddrInfo) ([]ma.Multiaddr, error) {
var addrs []ma.Multiaddr
p2ppart, err := ma.NewComponent("p2p", IDB58Encode(pi.ID))
Expand Down
6 changes: 3 additions & 3 deletions peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (id ID) String() string {
return id.Pretty()
}

// String prints out the peer ID.
// ShortString prints out the peer ID.
//
// TODO(brian): ensure correctness at ID generation and
// enforce this by only exposing functions that generate
Expand Down Expand Up @@ -85,7 +85,7 @@ func (id ID) MatchesPublicKey(pk ic.PubKey) bool {
return oid == id
}

// ExtractPublicKey attempts to extract the public key from an ID
// ExtractPublicKey attempts to extract the public key from an ID.
//
// This method returns ErrNoPublicKey if the peer ID looks valid but it can't extract
// the public key.
Expand Down Expand Up @@ -237,7 +237,7 @@ func IDFromPrivateKey(sk ic.PrivKey) (ID, error) {
return IDFromPublicKey(sk.GetPublic())
}

// IDSlice for sorting peers
// IDSlice for sorting peers.
type IDSlice []ID

func (es IDSlice) Len() int { return len(es) }
Expand Down
12 changes: 6 additions & 6 deletions peer/peer_serde.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file contains Protobuf and JSON serialization/deserialization methods for peer IDs.
// Package peer contains Protobuf and JSON serialization/deserialization methods for peer IDs.
package peer

import (
Expand All @@ -21,7 +21,7 @@ func (id ID) Marshal() ([]byte, error) {
return []byte(id), nil
}

// BinaryMarshal returns the byte representation of the peer ID.
// MarshalBinary returns the byte representation of the peer ID.
func (id ID) MarshalBinary() ([]byte, error) {
return id.Marshal()
}
Expand All @@ -35,12 +35,12 @@ func (id *ID) Unmarshal(data []byte) (err error) {
return err
}

// BinaryUnmarshal sets the ID from its binary representation.
// UnmarshalBinary sets the ID from its binary representation.
func (id *ID) UnmarshalBinary(data []byte) error {
return id.Unmarshal(data)
}

// Implements Gogo's proto.Sizer, but we omit the compile-time assertion to avoid introducing a hard
// Size implements Gogo's proto.Sizer, but we omit the compile-time assertion to avoid introducing a hard
// dependency on gogo.
func (id ID) Size() int {
return len([]byte(id))
Expand All @@ -59,12 +59,12 @@ func (id *ID) UnmarshalJSON(data []byte) (err error) {
return err
}

// TextMarshal returns the text encoding of the ID.
// MarshalText returns the text encoding of the ID.
func (id ID) MarshalText() ([]byte, error) {
return []byte(IDB58Encode(id)), nil
}

// TextUnmarshal restores the ID from its text encoding.
// UnmarshalText restores the ID from its text encoding.
func (id *ID) UnmarshalText(data []byte) error {
pid, err := IDB58Decode(string(data))
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions peer/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ func init() {
record.RegisterType(&PeerRecord{})
}

// The domain string used for peer records contained in a Envelope.
// PeerRecordEnvelopeDomain is the domain string used for peer records contained in a Envelope.
const PeerRecordEnvelopeDomain = "libp2p-peer-record"

// The type hint used to identify peer records in a Envelope.
// PeerRecordEnvelopePayloadType is the type hint used to identify peer records in a Envelope.
// Defined in https://github.com/multiformats/multicodec/blob/master/table.csv
// with name "libp2p-peer-record"
// with name "libp2p-peer-record".
var PeerRecordEnvelopePayloadType = []byte{0x03, 0x01}

// PeerRecord contains information that is broadly useful to share with other peers,
Expand Down
2 changes: 1 addition & 1 deletion peer/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
)

// PeerSet is a threadsafe set of peers
// PeerSet is a threadsafe set of peers.
type Set struct {
lk sync.RWMutex
ps map[ID]struct{}
Expand Down
10 changes: 5 additions & 5 deletions peerstore/peerstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
// AddressTTL is the expiration time of addresses.
AddressTTL = time.Hour

// TempAddrTTL is the ttl used for a short lived address
// TempAddrTTL is the ttl used for a short lived address.
TempAddrTTL = time.Minute * 2

// ProviderAddrTTL is the TTL of an address we've received from a provider.
Expand Down Expand Up @@ -115,10 +115,10 @@ type AddrBook interface {
// they will be sent along through the channel as well.
AddrStream(context.Context, peer.ID) <-chan ma.Multiaddr

// ClearAddresses removes all previously stored addresses
// ClearAddresses removes all previously stored addresses.
ClearAddrs(p peer.ID)

// PeersWithAddrs returns all of the peer IDs stored in the AddrBook
// PeersWithAddrs returns all of the peer IDs stored in the AddrBook.
PeersWithAddrs() peer.IDSlice
}

Expand Down Expand Up @@ -159,7 +159,7 @@ type CertifiedAddrBook interface {
//
// If the signed PeerRecord belongs to a peer that already has certified
// addresses in the CertifiedAddrBook, the new addresses will replace the
// older ones, iff the new record has a higher sequence number than the
// older ones, if the new record has a higher sequence number than the
// existing record. Attempting to add a peer record with a
// sequence number that's <= an existing record for the same peer will not
// result in an error, but the record will be ignored, and the 'accepted'
Expand Down Expand Up @@ -227,7 +227,7 @@ type Metrics interface {
LatencyEWMA(peer.ID) time.Duration
}

// ProtoBook tracks the protocols supported by peers
// ProtoBook tracks the protocols supported by peers.
type ProtoBook interface {
GetProtocols(peer.ID) ([]string, error)
AddProtocols(peer.ID, ...string) error
Expand Down

0 comments on commit 43f10f2

Please sign in to comment.