prysm-pulse/sharding/observer/service.go
Terence Tsao 035d0fb669 sharding/node: use ethdb.Database, remove database.ShardBackend
Former-commit-id: 44c0c5682c0296d94943b354171e69b4c8cf5312 [formerly 54da5cb45b098f0737fb3c37964e612dfe93c751]
Former-commit-id: 5d84d3c5038a01c4108e519d5a5c69033ace8ae2
2018-06-08 14:45:26 -07:00

35 lines
1021 B
Go

// Package observer launches a service attached to the sharding node
// that simply observes activity across the sharded Ethereum network.
package observer
import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding"
)
// 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 {
shardp2p sharding.ShardP2P
shardChainDb ethdb.Database
}
// NewObserver creates a new observer instance.
func NewObserver(shardp2p sharding.ShardP2P, shardChainDb ethdb.Database) (*Observer, error) {
return &Observer{shardp2p, shardChainDb}, nil
}
// Start the main routine for an observer.
func (o *Observer) Start() error {
log.Info("Starting shard observer service")
return nil
}
// Stop the main loop for observing the shard network.
func (o *Observer) Stop() error {
log.Info("Stopping shard observer service")
return nil
}