|
|
|
@ -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, |
|
|
|
@ -18,9 +68,9 @@ var DefaultForwardOrder = ForwardOrder{ |
|
|
|
|
Receipts, |
|
|
|
|
LastMile, |
|
|
|
|
Finish, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var DefaultRevertOrder = RevertOrder{ |
|
|
|
|
StagesRevertOrder = RevertOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
Receipts, |
|
|
|
@ -30,9 +80,9 @@ var DefaultRevertOrder = RevertOrder{ |
|
|
|
|
ShortRange, |
|
|
|
|
SyncEpoch, |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var DefaultCleanUpOrder = CleanUpOrder{ |
|
|
|
|
StagesCleanUpOrder = CleanUpOrder{ |
|
|
|
|
Finish, |
|
|
|
|
LastMile, |
|
|
|
|
Receipts, |
|
|
|
@ -42,6 +92,7 @@ var DefaultCleanUpOrder = CleanUpOrder{ |
|
|
|
|
ShortRange, |
|
|
|
|
SyncEpoch, |
|
|
|
|
Heads, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func DefaultStages(ctx context.Context, |
|
|
|
|