2024-08-13 11:27:34 +00:00
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import std/[options], chronos, libp2p/peerId
|
|
|
|
import ../waku_core
|
|
|
|
|
2024-10-24 12:31:04 +00:00
|
|
|
from ../waku_core/codecs import WakuSyncCodec
|
|
|
|
export WakuSyncCodec
|
|
|
|
|
2024-08-13 11:27:34 +00:00
|
|
|
const
|
|
|
|
DefaultSyncInterval*: Duration = 5.minutes
|
|
|
|
DefaultSyncRange*: Duration = 1.hours
|
|
|
|
RetryDelay*: Duration = 30.seconds
|
|
|
|
DefaultMaxFrameSize* = 1048576 # 1 MiB
|
|
|
|
DefaultGossipSubJitter*: Duration = 20.seconds
|
|
|
|
|
|
|
|
type
|
|
|
|
TransferCallback* = proc(
|
|
|
|
hashes: seq[WakuMessageHash], peerId: PeerId
|
|
|
|
): Future[Result[void, string]] {.async: (raises: []), closure.}
|
|
|
|
|
|
|
|
PruneCallback* = proc(
|
|
|
|
startTime: Timestamp, endTime: Timestamp, cursor = none(WakuMessageHash)
|
|
|
|
): Future[
|
|
|
|
Result[(seq[(WakuMessageHash, Timestamp)], Option[WakuMessageHash]), string]
|
|
|
|
] {.async: (raises: []), closure.}
|
|
|
|
|
|
|
|
SyncPayload* = object
|
|
|
|
syncRange*: Option[(uint64, uint64)]
|
|
|
|
|
|
|
|
frameSize*: Option[uint64]
|
|
|
|
|
|
|
|
negentropy*: seq[byte] # negentropy protocol payload
|
|
|
|
|
|
|
|
hashes*: seq[WakuMessageHash]
|