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:
Claude 2026-04-02 09:37:22 +01:00
parent e3f017aa9b
commit 21d205a0dc
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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