mirror of
https://github.com/logos-storage/logos-storage-network-crawler.git
synced 2026-01-03 14:03:09 +00:00
23 lines
586 B
Nim
23 lines
586 B
Nim
import pkg/chronos
|
|
import pkg/questionable
|
|
import pkg/questionable/results
|
|
import ../../../codexcrawler/services/dht
|
|
import ../../../codexcrawler/types
|
|
|
|
type MockDht* = ref object of Dht
|
|
routingTable*: seq[Nid]
|
|
getNeighborsArg*: ?Nid
|
|
getNeighborsReturn*: ?!GetNeighborsResponse
|
|
|
|
method getRoutingTableNodeIds*(d: MockDht): seq[Nid] =
|
|
return d.routingTable
|
|
|
|
method getNeighbors*(
|
|
d: MockDht, target: Nid
|
|
): Future[?!GetNeighborsResponse] {.async: (raises: []).} =
|
|
d.getNeighborsArg = some(target)
|
|
return d.getNeighborsReturn
|
|
|
|
proc createMockDht*(): MockDht =
|
|
MockDht()
|