Documentation ¶
Index ¶
- Variables
- func GRPCFunc(endpoint string) (client.VanguardClient, error)
- func SetupInProcServer(t *testing.T) (*rpc.Server, *events.MockBackend)
- type DIALGRPCFn
- type Service
- func (s *Service) OnNewConsensusInfo(ctx context.Context, consensusInfo *types.MinimalEpochConsensusInfo)
- func (s *Service) OnNewPendingVanguardBlock(ctx context.Context, block *eth.BeaconBlock)
- func (s *Service) Start()
- func (s *Service) Status() error
- func (s *Service) Stop() error
- func (s *Service) SubscribeMinConsensusInfoEvent(ch chan<- *types.MinimalEpochConsensusInfo) event.Subscription
- func (s *Service) SubscribeVanNewPendingBlockHash(ch chan<- *types.HeaderHash) event.Subscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConsensusInfoMocks []*eth.MinimalConsensusInfo PendingBlockMocks []*eth.BeaconBlock )
Functions ¶
func SetupInProcServer ¶
SetupInProcServer prepares in process server with defined api. Here, this method mocks vanguard client's endpoint as well as backend. Use in-memory to mock the
Types ¶
type DIALGRPCFn ¶
type DIALGRPCFn func(endpoint string) (client.VanguardClient, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service
- maintains connection with vanguard chain
- handles vanguard subscription for consensus info.
- sends new consensus info to all pandora subscribers.
- maintains consensusInfoDB to store the coming consensus info from vanguard.
func NewService ¶
func NewService( ctx context.Context, vanGRPCEndpoint string, db db.Database, dialGRPCFn DIALGRPCFn, ) (*Service, error)
NewService creates new service with vanguard endpoint, vanguard namespace and consensusInfoDB
func SetupVanguardSvc ¶
func SetupVanguardSvc( ctx context.Context, t *testing.T, dialGRPCFn DIALGRPCFn, ) (*Service, *mocks)
SetupVanguardSvc creates vanguard client service with mocked database
func (*Service) OnNewConsensusInfo ¶
func (s *Service) OnNewConsensusInfo(ctx context.Context, consensusInfo *types.MinimalEpochConsensusInfo)
OnNewConsensusInfo :
- sends the new consensus info to all subscribed pandora clients
- store consensus info into cache as well as into kv consensusInfoDB
func (*Service) OnNewPendingVanguardBlock ¶
func (s *Service) OnNewPendingVanguardBlock(ctx context.Context, block *eth.BeaconBlock)
func (*Service) Start ¶
func (s *Service) Start()
Start a consensus info fetcher service's main event loop.
func (*Service) SubscribeMinConsensusInfoEvent ¶
func (s *Service) SubscribeMinConsensusInfoEvent(ch chan<- *types.MinimalEpochConsensusInfo) event.Subscription
SubscribeMinConsensusInfoEvent registers a subscription of ChainHeadEvent.
func (*Service) SubscribeVanNewPendingBlockHash ¶
func (s *Service) SubscribeVanNewPendingBlockHash(ch chan<- *types.HeaderHash) event.Subscription
Click to show internal directories.
Click to hide internal directories.