ax(node): rename nm to manager in NewNodeManagerWithPaths for predictable naming
AX Principle 1 — nm abbreviates NodeManager, requiring mapping overhead. Rename to manager and update the NewNodeManager usage-example comment to match. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
ab7ccdda8a
commit
3a690ee485
1 changed files with 6 additions and 6 deletions
|
|
@ -79,9 +79,9 @@ type NodeManager struct {
|
|||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
// nm, err := node.NewNodeManager()
|
||||
// nodeManager, err := node.NewNodeManager()
|
||||
// if err != nil { return err }
|
||||
// if !nm.HasIdentity() { nm.GenerateIdentity("my-node", RoleDual) }
|
||||
// if !nodeManager.HasIdentity() { nodeManager.GenerateIdentity("my-node", RoleDual) }
|
||||
func NewNodeManager() (*NodeManager, error) {
|
||||
keyPath, err := xdg.DataFile("lethean-desktop/node/private.key")
|
||||
if err != nil {
|
||||
|
|
@ -99,18 +99,18 @@ func NewNodeManager() (*NodeManager, error) {
|
|||
// NewNodeManagerWithPaths creates a NodeManager with custom paths.
|
||||
// This is primarily useful for testing to avoid xdg path caching issues.
|
||||
func NewNodeManagerWithPaths(keyPath, configPath string) (*NodeManager, error) {
|
||||
nm := &NodeManager{
|
||||
manager := &NodeManager{
|
||||
keyPath: keyPath,
|
||||
configPath: configPath,
|
||||
}
|
||||
|
||||
// Try to load existing identity
|
||||
if err := nm.loadIdentity(); err != nil {
|
||||
if err := manager.loadIdentity(); err != nil {
|
||||
// Identity doesn't exist yet, that's ok
|
||||
return nm, nil
|
||||
return manager, nil
|
||||
}
|
||||
|
||||
return nm, nil
|
||||
return manager, nil
|
||||
}
|
||||
|
||||
// if nm.HasIdentity() { return nm.GetIdentity() }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue