2018-01-14 19:10:02 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-05-22 07:47:35 -05:00
|
|
|
"fmt"
|
|
|
|
|
2018-01-14 19:10:02 -05:00
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
2018-06-02 18:29:35 -04:00
|
|
|
node "github.com/ethereum/go-ethereum/sharding/node"
|
2018-01-14 19:10:02 -05:00
|
|
|
cli "gopkg.in/urfave/cli.v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2018-05-20 17:47:47 -05:00
|
|
|
shardingCommand = cli.Command{
|
2018-05-22 16:12:02 -06:00
|
|
|
Action: utils.MigrateFlags(shardingCmd),
|
2018-05-20 17:47:47 -05:00
|
|
|
Name: "sharding",
|
|
|
|
Usage: "Start a sharding-enabled node",
|
2018-01-20 19:07:41 -05:00
|
|
|
ArgsUsage: "[endpoint]",
|
2018-06-11 08:41:59 -07:00
|
|
|
Flags: []cli.Flag{utils.ActorFlag, utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag, utils.IPCPathFlag, utils.DepositFlag, utils.ShardIDFlag},
|
2018-01-20 19:07:41 -05:00
|
|
|
Category: "SHARDING COMMANDS",
|
|
|
|
Description: `
|
2018-05-22 11:33:46 -04:00
|
|
|
Launches a sharding node that manages services related to submitting collations to a Sharding Manager Contract, notary and proposer services, and shardp2p connections. This feature is a work in progress.
|
2018-01-20 19:07:41 -05:00
|
|
|
`,
|
2018-01-14 19:10:02 -05:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2018-05-22 16:12:02 -06:00
|
|
|
// shardingCmd is the main cmd line entry point for starting a sharding-enabled node.
|
2018-05-22 12:42:49 -04:00
|
|
|
// A sharding node launches a suite of services including notary services,
|
|
|
|
// proposer services, and a shardp2p protocol.
|
2018-05-22 16:12:02 -06:00
|
|
|
func shardingCmd(ctx *cli.Context) error {
|
2018-05-20 17:47:47 -05:00
|
|
|
// configures a sharding-enabled node using the cli's context.
|
2018-06-02 18:29:35 -04:00
|
|
|
shardingNode, err := node.New(ctx)
|
2018-05-22 18:35:03 -06:00
|
|
|
if err != nil {
|
2018-06-02 18:29:35 -04:00
|
|
|
return fmt.Errorf("could not initialize sharding node instance: %v", err)
|
2018-05-22 16:12:02 -06:00
|
|
|
}
|
2018-05-22 07:47:35 -05:00
|
|
|
defer shardingNode.Close()
|
2018-05-22 08:11:16 -05:00
|
|
|
// starts a connection to a geth node and kicks off every registered service.
|
2018-06-06 14:46:26 -04:00
|
|
|
shardingNode.Start()
|
2018-06-06 11:04:20 -04:00
|
|
|
return nil
|
2018-01-14 19:10:02 -05:00
|
|
|
}
|