mirror of
https://github.com/codex-storage/nim-codex-dht.git
synced 2025-02-12 11:56:56 +00:00
add ValueGetFrom count for naive getValue
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
08c07d6253
commit
42b306ea02
@ -130,6 +130,7 @@ const
|
|||||||
MaxProvidersEntries* = 1_000_000 # one million records
|
MaxProvidersEntries* = 1_000_000 # one million records
|
||||||
MaxProvidersPerEntry* = 20 # providers per entry
|
MaxProvidersPerEntry* = 20 # providers per entry
|
||||||
ValueReplication = 5 # store a value in this many nodes
|
ValueReplication = 5 # store a value in this many nodes
|
||||||
|
ValueGetFrom = 5 # try to get value from this many nodes (naive lookup based implementation)
|
||||||
## call
|
## call
|
||||||
|
|
||||||
func shortLog*(record: SignedPeerRecord): string =
|
func shortLog*(record: SignedPeerRecord): string =
|
||||||
@ -920,7 +921,7 @@ proc getValue*(
|
|||||||
let nodesNearby = await d.lookup(cId)
|
let nodesNearby = await d.lookup(cId)
|
||||||
trace "nearby:", nodesNearby
|
trace "nearby:", nodesNearby
|
||||||
var providersFut: seq[Future[DiscResult[ValueMessage]]]
|
var providersFut: seq[Future[DiscResult[ValueMessage]]]
|
||||||
for n in nodesNearby:
|
for n in nodesNearby[0 .. ValueGetFrom]:
|
||||||
if n != d.localNode:
|
if n != d.localNode:
|
||||||
providersFut.add(d.sendGetValue(n, cId))
|
providersFut.add(d.sendGetValue(n, cId))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user