mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-11 19:47:21 +00:00
* Somewhat tighten error handling why: Zombie state is invoked when the current peer turns out to be useless for further communication. While there is a chance to further talk to a peer about another topic (aka healing) after some protocol failure, it makes no sense to do so after a network problem. The latter state is explained bu the `peerDegraded` flag that goes together with the `zombie` state flag. A degraded peer is dropped immediately. * Remove `--sync-mode=snapCtx` option, always start snap in recovery mode why: No need for a snap sync option without recovery mode, can be achieved by deleting the database. * Code cosmetics, typos, prettify logging, debugging helper, etc. * Split off snap sync sub-mode handler into separate modules details: The original `worker.nim` source has become a multiplexer for several snap sync sub-modes `full` and `snap`. The source modules of the incarnations of a particular sync sub-mode are places into the `worker/play` directory. * Update ticker for snap and full sync logging
47 lines
1.5 KiB
Nim
47 lines
1.5 KiB
Nim
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
# http://opensource.org/licenses/MIT)
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
# except according to those terms.
|
|
|
|
{.push raises: [].}
|
|
|
|
import
|
|
chronos,
|
|
../../../sync_desc,
|
|
../../worker_desc
|
|
|
|
type
|
|
PlayVoidFutureCtxFn* = proc(
|
|
ctx: SnapCtxRef): Future[void] {.gcsafe, raises: [CatchableError].}
|
|
|
|
PlayVoidFutureBuddyFn* = proc(
|
|
buddy: SnapBuddyRef): Future[void] {.gcsafe, raises: [CatchableError].}
|
|
|
|
PlayBoolBuddyFn* = proc(
|
|
buddy: SnapBuddyRef, last: bool): bool {.gcsafe, raises: [CatchableError].}
|
|
|
|
PlaySyncSpecs* = ref object of RootRef
|
|
## Holds sync mode specs & methods for a particular sync state
|
|
pool*: PlayBoolBuddyFn
|
|
daemon*: PlayVoidFutureCtxFn
|
|
single*: PlayVoidFutureBuddyFn
|
|
multi*: PlayVoidFutureBuddyFn
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Public functions
|
|
# ------------------------------------------------------------------------------
|
|
|
|
proc playSyncSpecs*(ctx: SnapCtxRef): PlaySyncSpecs =
|
|
## Getter
|
|
ctx.pool.syncMode.tab[ctx.pool.syncMode.active].PlaySyncSpecs
|
|
|
|
proc `playMode=`*(ctx: SnapCtxRef; val: SnapSyncModeType) =
|
|
## Setter
|
|
ctx.pool.syncMode.active = val
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# End
|
|
# ------------------------------------------------------------------------------
|