2022-10-08 17:20:50 +00:00
|
|
|
# Nimbus
|
2024-02-04 14:28:20 +00:00
|
|
|
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
2022-08-04 08:04:30 +00:00
|
|
|
# Licensed under either of
|
|
|
|
# * 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.
|
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
{.push raises: [].}
|
|
|
|
|
2022-08-04 08:04:30 +00:00
|
|
|
import
|
2022-10-20 16:59:54 +00:00
|
|
|
eth/[common, p2p],
|
2023-04-25 16:34:48 +00:00
|
|
|
../misc/ticker,
|
2022-10-20 16:59:54 +00:00
|
|
|
../sync_desc,
|
2023-04-24 20:24:07 +00:00
|
|
|
./worker/get/get_error,
|
2023-04-25 16:34:48 +00:00
|
|
|
./worker/db/[snapdb_desc]
|
2022-08-04 08:04:30 +00:00
|
|
|
|
2023-04-24 20:24:07 +00:00
|
|
|
export
|
|
|
|
sync_desc # worker desc prototype
|
|
|
|
|
2022-08-04 08:04:30 +00:00
|
|
|
type
|
2023-03-03 20:01:59 +00:00
|
|
|
SnapBuddyData* = object
|
2023-04-25 16:34:48 +00:00
|
|
|
## Peer-worker local descriptor data extension
|
2023-04-24 20:24:07 +00:00
|
|
|
errors*: GetErrorStatsRef ## For error handling
|
2023-04-25 16:34:48 +00:00
|
|
|
full*: RootRef ## Peer local full sync descriptor
|
2023-04-26 15:46:42 +00:00
|
|
|
# snap*: RootRef ## Peer local snap sync descriptor
|
2023-04-14 22:28:57 +00:00
|
|
|
|
2023-04-24 20:24:07 +00:00
|
|
|
SnapSyncPassType* = enum
|
2023-04-06 19:42:07 +00:00
|
|
|
## Current sync mode, after a snapshot has been downloaded, the system
|
|
|
|
## proceeds with full sync.
|
|
|
|
SnapSyncMode = 0 ## Start mode
|
|
|
|
FullSyncMode
|
|
|
|
|
2023-04-24 20:24:07 +00:00
|
|
|
SnapSyncPass* = object
|
2023-04-06 19:42:07 +00:00
|
|
|
## Full specs for all sync modes. This table must be held in the main
|
|
|
|
## descriptor and initialised at run time. The table values are opaque
|
|
|
|
## and will be specified in the worker module(s).
|
2023-04-24 20:24:07 +00:00
|
|
|
active*: SnapSyncPassType
|
|
|
|
tab*: array[SnapSyncPassType,RootRef]
|
2022-08-24 13:44:18 +00:00
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
SnapCtxData* = object
|
2022-08-04 08:04:30 +00:00
|
|
|
## Globally shared data extension
|
2022-09-02 18:16:09 +00:00
|
|
|
rng*: ref HmacDrbgContext ## Random generator
|
2022-11-16 23:51:06 +00:00
|
|
|
snapDb*: SnapDbRef ## Accounts snapshot DB
|
|
|
|
|
2023-04-24 20:24:07 +00:00
|
|
|
# Info
|
2023-04-26 15:46:42 +00:00
|
|
|
beaconHeader*: BlockHeader ## Running on beacon chain
|
2023-04-24 20:24:07 +00:00
|
|
|
enableTicker*: bool ## Advisary, extra level of gossip
|
|
|
|
ticker*: TickerRef ## Ticker, logger descriptor
|
|
|
|
|
|
|
|
# Snap/full mode muliplexing
|
|
|
|
syncMode*: SnapSyncPass ## Sync mode methods & data
|
|
|
|
|
|
|
|
# Snap sync parameters, pivot table
|
2023-04-25 16:34:48 +00:00
|
|
|
snap*: RootRef ## Global snap sync descriptor
|
2023-04-06 19:42:07 +00:00
|
|
|
|
2023-04-14 22:28:57 +00:00
|
|
|
# Full sync continuation parameters
|
2023-04-25 16:34:48 +00:00
|
|
|
fullHeader*: Option[BlockHeader] ## Start full sync from here
|
|
|
|
full*: RootRef ## Global full sync descriptor
|
2023-04-14 22:28:57 +00:00
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
SnapBuddyRef* = BuddyRef[SnapCtxData,SnapBuddyData]
|
2022-08-04 08:04:30 +00:00
|
|
|
## Extended worker peer descriptor
|
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
SnapCtxRef* = CtxRef[SnapCtxData]
|
2022-08-04 08:04:30 +00:00
|
|
|
## Extended global descriptor
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# End
|
|
|
|
# ------------------------------------------------------------------------------
|