mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-05-11 22:09:32 +00:00
Merge 9d0fec5721e256804aed0adf01df5197293d2566 into cf2f40f5591ce9e75e49b5c7e70d2ec53d296cfd
This commit is contained in:
commit
e503e946d1
@ -272,15 +272,22 @@ type
|
||||
name: "block-retries"
|
||||
.}: int
|
||||
|
||||
cacheSize* {.
|
||||
discoveryTableIpLimit* {.
|
||||
desc: "Maximum number of nodes with the same IP in the discovery routing table",
|
||||
defaultValue: 10'u,
|
||||
defaultValueDesc: "10",
|
||||
name: "discovery-table-ip-limit",
|
||||
hidden
|
||||
.}: uint
|
||||
|
||||
discoveryBucketIpLimit* {.
|
||||
desc:
|
||||
"The size of the block cache, 0 disables the cache - " &
|
||||
"might help on slow hardrives",
|
||||
defaultValue: 0,
|
||||
defaultValueDesc: "0",
|
||||
name: "cache-size",
|
||||
abbr: "c"
|
||||
.}: NBytes
|
||||
"Maximum number of nodes with the same IP per bucket in the discovery routing table",
|
||||
defaultValue: 2'u,
|
||||
defaultValueDesc: "2",
|
||||
name: "discovery-bucket-ip-limit",
|
||||
hidden
|
||||
.}: uint
|
||||
|
||||
logFile* {.
|
||||
desc: "Logs to file", defaultValue: string.none, name: "log-file", hidden
|
||||
|
||||
@ -240,6 +240,7 @@ proc new*(
|
||||
announceAddrs: openArray[MultiAddress],
|
||||
bootstrapNodes: openArray[SignedPeerRecord] = [],
|
||||
store: Datastore = SQLiteDatastore.new(Memory).expect("Should not fail!"),
|
||||
tableIpLimits: TableIpLimits = DefaultTableIpLimits,
|
||||
): Discovery =
|
||||
## Create a new Discovery node instance for the given key and datastore
|
||||
##
|
||||
@ -250,14 +251,8 @@ proc new*(
|
||||
|
||||
self.updateAnnounceRecord(announceAddrs)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# FIXME disable IP limits temporarily so we can run our workshop. Re-enable
|
||||
# and figure out proper solution.
|
||||
let discoveryConfig = DiscoveryConfig(
|
||||
tableIpLimits: TableIpLimits(tableIpLimit: high(uint), bucketIpLimit: high(uint)),
|
||||
bitsPerHop: DefaultBitsPerHop,
|
||||
)
|
||||
# --------------------------------------------------------------------------
|
||||
let discoveryConfig =
|
||||
DiscoveryConfig(tableIpLimits: tableIpLimits, bitsPerHop: DefaultBitsPerHop)
|
||||
|
||||
self.protocol = newProtocol(
|
||||
key,
|
||||
|
||||
@ -184,9 +184,7 @@ proc new*(
|
||||
.withTcpTransport({ServerFlags.ReuseAddr, ServerFlags.TcpNoDelay})
|
||||
.build()
|
||||
|
||||
var
|
||||
cache: CacheStore = nil
|
||||
taskPool: Taskpool
|
||||
var taskPool: Taskpool
|
||||
|
||||
try:
|
||||
if config.numThreads == ThreadCount(0):
|
||||
@ -197,10 +195,6 @@ proc new*(
|
||||
except CatchableError as exc:
|
||||
raiseAssert("Failure in taskPool initialization:" & exc.msg)
|
||||
|
||||
if config.cacheSize > 0'nb:
|
||||
cache = CacheStore.new(cacheSize = config.cacheSize)
|
||||
## Is unused?
|
||||
|
||||
let discoveryDir = config.dataDir / StorageDhtNamespace
|
||||
|
||||
if io2.createPath(discoveryDir).isErr:
|
||||
|
||||
@ -5,6 +5,7 @@ import pkg/taskpools
|
||||
import pkg/libp2p
|
||||
import pkg/libp2p/errors
|
||||
|
||||
import pkg/codexdht/discv5/routing_table
|
||||
import pkg/storage/discovery
|
||||
import pkg/storage/stores
|
||||
import pkg/storage/blocktype as bt
|
||||
@ -180,6 +181,8 @@ proc generateNodes*(
|
||||
bindPort = bindPort.Port,
|
||||
store = blockDiscoveryStore,
|
||||
bootstrapNodes = bootstrapNodes,
|
||||
tableIpLimits =
|
||||
TableIpLimits(tableIpLimit: high(uint), bucketIpLimit: high(uint)),
|
||||
)
|
||||
else:
|
||||
nullDiscovery()
|
||||
@ -189,8 +192,12 @@ proc generateNodes*(
|
||||
else:
|
||||
let
|
||||
store = CacheStore.new(blocks.mapIt(it))
|
||||
discovery =
|
||||
Discovery.new(switch.peerInfo.privateKey, announceAddrs = @[listenAddr])
|
||||
discovery = Discovery.new(
|
||||
switch.peerInfo.privateKey,
|
||||
announceAddrs = @[listenAddr],
|
||||
tableIpLimits =
|
||||
TableIpLimits(tableIpLimit: high(uint), bucketIpLimit: high(uint)),
|
||||
)
|
||||
(store.BlockStore, newSeq[TempLevelDb](), discovery)
|
||||
|
||||
let
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user