|
|
|
@ -8,7 +8,57 @@ type ForwardOrder []SyncStageID |
|
|
|
|
type RevertOrder []SyncStageID |
|
|
|
|
type CleanUpOrder []SyncStageID |
|
|
|
|
|
|
|
|
|
var DefaultForwardOrder = ForwardOrder{ |
|
|
|
|
var ( |
|
|
|
|
StagesForwardOrder ForwardOrder |
|
|
|
|
StagesRevertOrder RevertOrder |
|
|
|
|
StagesCleanUpOrder CleanUpOrder |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func initStagesOrder(syncMode SyncMode) { |
|
|
|
|
switch syncMode { |
|
|
|
|
case FullSync: |
|
|
|
|
initFullSyncStagesOrder() |
|
|
|
|
case FastSync: |
|
|
|
|
initFastSyncStagesOrder() |
|
|
|
|
default: |
|
|
|
|
panic("not supported sync mode") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func initFullSyncStagesOrder() { |
|
|
|
|
StagesForwardOrder = ForwardOrder{ |
|
|
|
|
Heads, |
|
|
|
|
SyncEpoch, |
|
|
|
|
ShortRange, |
|
|
|
|
BlockBodies, |
|
|
|
|
States, |
|
|
|
|
LastMile, |
|
|
|
|
Finish, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
StagesRevertOrder = RevertOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
States, |
|
|
|
|
BlockBodies, |
|
|
|
|
ShortRange, |
|
|
|
|
SyncEpoch, |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
StagesCleanUpOrder = CleanUpOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
States, |
|
|
|
|
BlockBodies, |
|
|
|
|
ShortRange, |
|
|
|
|
SyncEpoch, |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func initFastSyncStagesOrder() { |
|
|
|
|
StagesForwardOrder = ForwardOrder{ |
|
|
|
|
Heads, |
|
|
|
|
SyncEpoch, |
|
|
|
|
ShortRange, |
|
|
|
@ -20,7 +70,7 @@ var DefaultForwardOrder = ForwardOrder{ |
|
|
|
|
Finish, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var DefaultRevertOrder = RevertOrder{ |
|
|
|
|
StagesRevertOrder = RevertOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
Receipts, |
|
|
|
@ -32,7 +82,7 @@ var DefaultRevertOrder = RevertOrder{ |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var DefaultCleanUpOrder = CleanUpOrder{ |
|
|
|
|
StagesCleanUpOrder = CleanUpOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
Receipts, |
|
|
|
@ -43,6 +93,7 @@ var DefaultCleanUpOrder = CleanUpOrder{ |
|
|
|
|
SyncEpoch, |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func DefaultStages(ctx context.Context, |
|
|
|
|
headsCfg StageHeadsCfg, |
|
|
|
|