prysm-pulse/cmd/geth/shardingcmd.go
Raul Jordan e17900ac18 sharding: graceful shutdown of all services
Former-commit-id: 47da16d4915e10d9755d641c5c4102eb8c90beed [formerly 0b3e95b7037fb7c3e00b0460e615cff64ac1844f]
Former-commit-id: da75e9d2766922d6fe375f8770795f2d6dde113c
2018-06-06 13:22:21 -04:00

41 lines
1.4 KiB
Go

package main
import (
"fmt"
"github.com/ethereum/go-ethereum/cmd/utils"
node "github.com/ethereum/go-ethereum/sharding/node"
cli "gopkg.in/urfave/cli.v1"
)
var (
shardingCommand = cli.Command{
Action: utils.MigrateFlags(shardingCmd),
Name: "sharding",
Usage: "Start a sharding-enabled node",
ArgsUsage: "[endpoint]",
Flags: []cli.Flag{utils.ActorFlag, utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag, utils.IPCPathFlag, utils.DepositFlag},
Category: "SHARDING COMMANDS",
Description: `
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.
`,
}
)
// shardingCmd is the main cmd line entry point for starting a sharding-enabled node.
// A sharding node launches a suite of services including notary services,
// proposer services, and a shardp2p protocol.
func shardingCmd(ctx *cli.Context) error {
// configures a sharding-enabled node using the cli's context.
shardingNode, err := node.New(ctx)
if err != nil {
return fmt.Errorf("could not initialize sharding node instance: %v", err)
}
defer shardingNode.Close()
// starts a connection to a geth node and kicks off every registered service.
if err := shardingNode.Start(); err != nil {
return fmt.Errorf("Could not start sharding node: %v", err)
}
return nil
}