-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
867 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var cleanupLevelDBCmd = &cli.Command{ | ||
Name: "leveldb", | ||
Description: "Removes the indexes and other metadata leveldb based LID store", | ||
Usage: "migrate-curio cleanup leveldb", | ||
Before: before, | ||
Action: func(cctx *cli.Context) error { | ||
fmt.Println("Please remove the directory called 'LID' in the boost repo path to remove leveldb based LID") | ||
fmt.Println("This directory can also be present outside of Boost repo if 'boostd-data' was running with a custom repo path") | ||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/filecoin-project/boost/build" | ||
logging "github.com/ipfs/go-log/v2" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var log = logging.Logger("migrate-curio") | ||
|
||
const ( | ||
FlagBoostRepo = "boost-repo" | ||
) | ||
|
||
var FlagRepo = &cli.StringFlag{ | ||
Name: FlagBoostRepo, | ||
EnvVars: []string{"BOOST_PATH"}, | ||
Usage: "boost repo path", | ||
Value: "~/.boost", | ||
} | ||
|
||
var IsVeryVerbose bool | ||
|
||
var FlagVeryVerbose = &cli.BoolFlag{ | ||
Name: "vv", | ||
Usage: "enables very verbose mode, useful for debugging the CLI", | ||
Destination: &IsVeryVerbose, | ||
} | ||
|
||
func main() { | ||
app := &cli.App{ | ||
Name: "migrate-curio", | ||
Usage: "Migrate boost to Curio", | ||
EnableBashCompletion: true, | ||
Version: build.UserVersion(), | ||
Flags: []cli.Flag{ | ||
FlagRepo, | ||
FlagVeryVerbose, | ||
&cli.StringFlag{ | ||
Name: "db-host", | ||
EnvVars: []string{"CURIO_DB_HOST", "CURIO_HARMONYDB_HOSTS"}, | ||
Usage: "Command separated list of hostnames for yugabyte cluster", | ||
Value: "127.0.0.1", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "db-name", | ||
EnvVars: []string{"CURIO_DB_NAME", "CURIO_HARMONYDB_NAME"}, | ||
Value: "yugabyte", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "db-user", | ||
EnvVars: []string{"CURIO_DB_USER", "CURIO_HARMONYDB_USERNAME"}, | ||
Value: "yugabyte", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "db-password", | ||
EnvVars: []string{"CURIO_DB_PASSWORD", "CURIO_HARMONYDB_PASSWORD"}, | ||
Value: "yugabyte", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "db-port", | ||
EnvVars: []string{"CURIO_DB_PORT", "CURIO_HARMONYDB_PORT"}, | ||
Value: "5433", | ||
}, | ||
}, | ||
Commands: []*cli.Command{ | ||
migrateCmd, | ||
cleanupLIDCmd, | ||
}, | ||
} | ||
app.Setup() | ||
|
||
if err := app.Run(os.Args); err != nil { | ||
os.Stderr.WriteString("Error: " + err.Error() + "\n") | ||
} | ||
} | ||
|
||
func before(cctx *cli.Context) error { | ||
_ = logging.SetLogLevel("migrate-curio", "INFO") | ||
|
||
if IsVeryVerbose { | ||
_ = logging.SetLogLevel("migrate-curio", "DEBUG") | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.