ax(node): rename pr to registry in NewPeerRegistryWithPath
`pr` abbreviates PeerRegistry — violates AX Principle 1 (predictable names over short names). Renamed to `registry` so the variable is self-describing without context. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
e3f017aa9b
commit
21d205a0dc
1 changed files with 6 additions and 6 deletions
|
|
@ -135,7 +135,7 @@ func NewPeerRegistry() (*PeerRegistry, error) {
|
|||
// registry, err := node.NewPeerRegistryWithPath("/tmp/test-peers.json")
|
||||
// used in tests to avoid xdg path caching
|
||||
func NewPeerRegistryWithPath(peersPath string) (*PeerRegistry, error) {
|
||||
pr := &PeerRegistry{
|
||||
registry := &PeerRegistry{
|
||||
peers: make(map[string]*Peer),
|
||||
path: peersPath,
|
||||
stopChan: make(chan struct{}),
|
||||
|
|
@ -144,14 +144,14 @@ func NewPeerRegistryWithPath(peersPath string) (*PeerRegistry, error) {
|
|||
}
|
||||
|
||||
// Try to load existing peers
|
||||
if err := pr.load(); err != nil {
|
||||
if err := registry.load(); err != nil {
|
||||
// No existing peers, that's ok
|
||||
pr.rebuildKDTree()
|
||||
return pr, nil
|
||||
registry.rebuildKDTree()
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
pr.rebuildKDTree()
|
||||
return pr, nil
|
||||
registry.rebuildKDTree()
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
// registry.SetAuthMode(PeerAuthAllowlist) // require pre-registration
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue