prysm-pulse/sharding/observer/service.go
Preston Van Loon 67c37cde39 Remove unnecessary interface. Remove "shard" prefix from many places
Former-commit-id: 3782465be416107779942a03984ae0b77e5efd20 [formerly 6ef8e5ea1b51845a9510e0597681a001f602076d]
Former-commit-id: 0bd84c0478896264737f96ec4d08e9587dd2172c
2018-06-13 08:44:33 -04:00

37 lines
1.1 KiB
Go

// Package observer launches a service attached to the sharding node
// that simply observes activity across the sharded Ethereum network.
package observer
import (
"fmt"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding/p2p"
)
// Observer holds functionality required to run an observer service
// in a sharded system. Must satisfy the Service interface defined in
// sharding/service.go.
type Observer struct {
p2p *p2p.Server
shardChainDb ethdb.Database
shardID int
}
// NewObserver creates a new observer instance.
func NewObserver(p2p *p2p.Server, shardChainDb ethdb.Database, shardID int) (*Observer, error) {
return &Observer{p2p, shardChainDb, shardID}, nil
}
// Start the main routine for an observer.
func (o *Observer) Start() {
log.Info(fmt.Sprintf("Starting observer service in shard %d", o.shardID))
}
// Stop the main loop for observing the shard network.
func (o *Observer) Stop() error {
log.Info(fmt.Sprintf("Starting observer service in shard %d", o.shardID))
return nil
}