Refactor sync package to use the strategy approach #4112
Labels
C-complex
Complex changes across multiple modules. Possibly will require additional research.
P-high
this should be addressed ASAP.
S-network
issues related to the dot/network package.
T-enhancement
this issue/pr covers improvement of existing functionality.
Issue summary
Currently, Gossamer sync package is full writing for full sync method, so everything in the sync package is a lot coupled and there is no room to expand or introduce a new sync strategy, such as Warp Sync, without a huge code change.
What I am proposing here is to change the sync package a single
SyncService
and this service contains a strategy that can beFullSyncStrategy
orWarpSyncStrategy
both implementing the interfaceStrategy
and all that theSyncService
knows is that it has a propertystrategy
of typeStrategy
.The
SyncService
works in a loop that execs the following actions:strategy.NextActions()
strategy.IsFinished()
Strategy
interface does not need to have any knowledge about network or workers, it should only know about its current state like: forks, fragments, blocks announcedThe approach is explained in this PDF
WARP Sync slides (1).pdf
The text was updated successfully, but these errors were encountered: