Skip to content

Commit

Permalink
add SyncMode to flags
Browse files Browse the repository at this point in the history
  • Loading branch information
GheisMohammadi committed Jul 13, 2023
1 parent f242513 commit 54e26c3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/harmony/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ var (

syncFlags = []cli.Flag{
syncStreamEnabledFlag,
syncModeFlag,
syncDownloaderFlag,
syncStagedSyncFlag,
syncConcurrencyFlag,
Expand Down Expand Up @@ -1812,6 +1813,13 @@ var (
Usage: "Enable the stream sync protocol (experimental feature)",
DefValue: false,
}

syncModeFlag = cli.IntFlag{
Name: "sync.mode",
Usage: "synchronization mode of the downloader (0=FullSync, 1=FastSync, 2=SnapSync)",
DefValue: 0,
}

// TODO: Deprecate this flag, and always set to true after stream sync is fully up.
syncDownloaderFlag = cli.BoolFlag{
Name: "sync.downloader",
Expand Down Expand Up @@ -1873,6 +1881,10 @@ func applySyncFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) {
config.Sync.Enabled = cli.GetBoolFlagValue(cmd, syncStreamEnabledFlag)
}

if cli.IsFlagChanged(cmd, syncModeFlag) {
config.Sync.SyncMode = uint32(cli.GetIntFlagValue(cmd, syncModeFlag))
}

if cli.IsFlagChanged(cmd, syncDownloaderFlag) {
config.Sync.Downloader = cli.GetBoolFlagValue(cmd, syncDownloaderFlag)
}
Expand Down

0 comments on commit 54e26c3

Please sign in to comment.