fix: wrong imports and references to Config
This commit is contained in:
parent
0b6ef02572
commit
19b0785c48
18
node/node.go
18
node/node.go
|
@ -1,7 +1,7 @@
|
||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.lumeweb.com/LumeWeb/libs5-go"
|
"git.lumeweb.com/LumeWeb/libs5-go/config"
|
||||||
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
|
||||||
"git.lumeweb.com/LumeWeb/libs5-go/service"
|
"git.lumeweb.com/LumeWeb/libs5-go/service"
|
||||||
"git.lumeweb.com/LumeWeb/libs5-go/structs"
|
"git.lumeweb.com/LumeWeb/libs5-go/structs"
|
||||||
|
@ -27,7 +27,7 @@ func (s *Services) P2P() *service.P2P {
|
||||||
const cacheBucketName = "object-cache"
|
const cacheBucketName = "object-cache"
|
||||||
|
|
||||||
type Node struct {
|
type Node struct {
|
||||||
nodeConfig *libs5_go.NodeConfig
|
nodeConfig *config.NodeConfig
|
||||||
metadataCache *structs.Map
|
metadataCache *structs.Map
|
||||||
started bool
|
started bool
|
||||||
hashQueryRoutingTable *structs.Map
|
hashQueryRoutingTable *structs.Map
|
||||||
|
@ -39,7 +39,7 @@ func (n *Node) Services() *Services {
|
||||||
return &n.services
|
return &n.services
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNode(config *libs5_go.NodeConfig) *Node {
|
func NewNode(config *config.NodeConfig) *Node {
|
||||||
return &Node{
|
return &Node{
|
||||||
nodeConfig: config,
|
nodeConfig: config,
|
||||||
metadataCache: structs.NewMap(),
|
metadataCache: structs.NewMap(),
|
||||||
|
@ -55,7 +55,7 @@ func (n *Node) IsStarted() bool {
|
||||||
return n.started
|
return n.started
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) Config() *libs5_go.NodeConfig {
|
func (n *Node) Config() *config.NodeConfig {
|
||||||
return n.nodeConfig
|
return n.nodeConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ func (n *Node) GetCachedStorageLocations(hash *encoding.Multihash, types []int)
|
||||||
}
|
}
|
||||||
return locations, nil
|
return locations, nil
|
||||||
}
|
}
|
||||||
func (n *Node) readStorageLocationsFromDB(hash *encoding.Multihash) (libs5_go.storageLocationMap, error) {
|
func (n *Node) readStorageLocationsFromDB(hash *encoding.Multihash) (storageLocationMap, error) {
|
||||||
locationMap := libs5_go.newStorageLocationMap()
|
locationMap := newStorageLocationMap()
|
||||||
|
|
||||||
bytes := n.cacheBucket.Get(hash.FullBytes())
|
bytes := n.cacheBucket.Get(hash.FullBytes())
|
||||||
if bytes == nil {
|
if bytes == nil {
|
||||||
|
@ -167,7 +167,7 @@ func (n *Node) readStorageLocationsFromDB(hash *encoding.Multihash) (libs5_go.st
|
||||||
|
|
||||||
return locationMap, nil
|
return locationMap, nil
|
||||||
}
|
}
|
||||||
func (n *Node) AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location *StorageLocation, message []byte, config *libs5_go.NodeConfig) error {
|
func (n *Node) AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location *StorageLocation, message []byte, config *config.NodeConfig) error {
|
||||||
// Read existing storage locations
|
// Read existing storage locations
|
||||||
locationDb, err := n.readStorageLocationsFromDB(hash)
|
locationDb, err := n.readStorageLocationsFromDB(hash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -182,8 +182,8 @@ func (n *Node) AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.Nod
|
||||||
// Get or create the inner map for the specific type
|
// Get or create the inner map for the specific type
|
||||||
innerMap, exists := locationDb[location.Type]
|
innerMap, exists := locationDb[location.Type]
|
||||||
if !exists {
|
if !exists {
|
||||||
innerMap = make(libs5_go.nodeStorage, 1)
|
innerMap = make(nodeStorage, 1)
|
||||||
innerMap[nodeIdStr] = make(libs5_go.nodeDetailsStorage, 1)
|
innerMap[nodeIdStr] = make(nodeDetailsStorage, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create location map with new data
|
// Create location map with new data
|
||||||
|
|
Loading…
Reference in New Issue