diff --git a/sharding/node/node.go b/sharding/node/node.go index a1995d506..f650e15ed 100644 --- a/sharding/node/node.go +++ b/sharding/node/node.go @@ -112,6 +112,7 @@ func (n *shardingNode) registerShardingServices() error { clientType := n.ctx.GlobalString(utils.ClientType.Name) err := n.Register(func(ctx *node.ServiceContext) (node.Service, error) { + // TODO(terenc3t): handle case when we just want to start an observer node. if clientType == "notary" { return notary.NewNotary(n.ctx) } diff --git a/sharding/proposer/proposer.go b/sharding/proposer/proposer.go new file mode 100644 index 000000000..d7aa1dba4 --- /dev/null +++ b/sharding/proposer/proposer.go @@ -0,0 +1,29 @@ +package proposer + +import ( + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/sharding/node" + "github.com/ethereum/go-ethereum/swarm/api/client" + cli "gopkg.in/urfave/cli.v1" +) + +// Proposer holds functionality required to run a collation proposer +// in a sharded system. Must satisfy the Service interface defined in +// sharding/service.go. +type Proposer struct { + client client.Client +} + +// NewProposer creates a struct instance. It is initialized and +// registered as a service upon start of a sharding node. +// Has access to the public methods of this node. +func NewProposer(ctx *cli.Context, node node.Node) *Proposer { + return &Proposer{} +} + +// Start the main entry point for proposing collations. +func (p *Proposer) Start() error { + log.Info("Starting proposer client") + // TODO: Propose collations. + return nil +} diff --git a/sharding/proposer/proposer_client.go b/sharding/proposer/proposer_client.go deleted file mode 100644 index e009b4d4f..000000000 --- a/sharding/proposer/proposer_client.go +++ /dev/null @@ -1,38 +0,0 @@ -package proposer - -import ( - "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/sharding/client" - cli "gopkg.in/urfave/cli.v1" -) - -// Proposer holds functionality required to run a collation proposer -// in a sharded system. -type Proposer interface { - Start() error -} - -type proposer struct { - client client.Client -} - -// NewProposer creates a struct instance. -func NewProposer(ctx *cli.Context) Proposer { - return &proposer{ - client: client.NewClient(ctx), - } -} - -// Start the main entry point for proposing collations. -func (p *proposer) Start() error { - log.Info("Starting proposer client") - err := p.client.Start() - if err != nil { - return err - } - defer p.client.Close() - - // TODO: Propose collations. - - return nil -}