mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
ed1200b1a0
Former-commit-id: 6016b3f659b6d325061f7862e2b0b7d9c882df93 [formerly 64aa7c188428e5f0415062d22f65093be73cf20a] Former-commit-id: ba6af02c1a8cffbc36edaa04685ac7a456c03919
37 lines
1.1 KiB
Go
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"
|
|
)
|
|
|
|
// 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
|
|
shardID int
|
|
}
|
|
|
|
// NewObserver creates a new observer instance.
|
|
func NewObserver(shardp2p sharding.ShardP2P, shardChainDb ethdb.Database, shardID int) (*Observer, error) {
|
|
return &Observer{shardp2p, 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
|
|
}
|