refactor: add NetworkId() to node
This commit is contained in:
parent
ebd95f59d4
commit
3ce371986b
|
@ -18,4 +18,5 @@ type Node interface {
|
||||||
Start() error
|
Start() error
|
||||||
GetCachedStorageLocations(hash *encoding.Multihash, types []int) (map[string]StorageLocation, error)
|
GetCachedStorageLocations(hash *encoding.Multihash, types []int) (map[string]StorageLocation, error)
|
||||||
AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location StorageLocation, message []byte, config *config.NodeConfig) error
|
AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location StorageLocation, message []byte, config *config.NodeConfig) error
|
||||||
|
NetworkId() string
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,5 @@ type P2PService interface {
|
||||||
ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error)
|
ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error)
|
||||||
GetNodeScore(nodeId *encoding.NodeId) (float64, error)
|
GetNodeScore(nodeId *encoding.NodeId) (float64, error)
|
||||||
SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
|
SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
|
||||||
|
SignMessageSimple(message []byte) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@ type NodeImpl struct {
|
||||||
cacheBucket *bolt.Bucket
|
cacheBucket *bolt.Bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *NodeImpl) NetworkId() string {
|
||||||
|
return n.nodeConfig.P2P.Network
|
||||||
|
}
|
||||||
|
|
||||||
func (n *NodeImpl) Services() interfaces.Services {
|
func (n *NodeImpl) Services() interfaces.Services {
|
||||||
return n.services
|
return n.services
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue