mirror of
https://github.com/logos-storage/logos-storage-network-crawler.git
synced 2026-01-02 13:33:08 +00:00
28 lines
667 B
Nim
28 lines
667 B
Nim
import pkg/chronos
|
|
import pkg/questionable/results
|
|
|
|
import ./config
|
|
import ./utils/asyncdataevent
|
|
import ./types
|
|
|
|
type
|
|
OnStep = proc(): Future[?!void] {.async: (raises: []), gcsafe.}
|
|
|
|
DhtNodeCheckEventData* = object
|
|
id*: Nid
|
|
isOk*: bool
|
|
|
|
Events* = ref object
|
|
nodesFound*: AsyncDataEvent[seq[Nid]]
|
|
newNodesDiscovered*: AsyncDataEvent[seq[Nid]]
|
|
dhtNodeCheck*: AsyncDataEvent[DhtNodeCheckEventData]
|
|
nodesExpired*: AsyncDataEvent[seq[Nid]]
|
|
|
|
State* = ref object
|
|
config*: Config
|
|
events*: Events
|
|
|
|
proc whileRunning*(this: State, step: OnStep, delay: Duration) =
|
|
discard
|
|
#todo: while status == running, step(), asyncsleep duration
|