vanguardchain

package
v0.0.16-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupInProcServer

func SetupInProcServer(t *testing.T) (*rpc.Server, *events.MockBackend)

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 DialRPCFn

type DialRPCFn func(endpoint string) (*rpc.Client, error)

DialRPCFn dials to the given endpoint

func DialInProcClient

func DialInProcClient(server *rpc.Server) DialRPCFn

DialInProcClient creates in process client for vanguard mocked server

func DialRPCClient

func DialRPCClient() DialRPCFn

DialRPCClient creates in process client for vanguard rpc server

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 db to store the coming consensus info from vanguard.

func NewService

func NewService(ctx context.Context, vanEndpoint string, namespace string,
	db db.ConsensusInfoAccessDB, dialRPCFn DialRPCFn) (*Service, error)

NewService creates new service with vanguard endpoint, vanguard namespace and db

func SetupVanguardSvc

func SetupVanguardSvc(ctx context.Context, t *testing.T, dialRPCFn DialRPCFn) (*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 db

func (*Service) Start

func (s *Service) Start()

Start a consensus info fetcher service's main event loop.

func (*Service) Status

func (s *Service) Status() error

func (*Service) Stop

func (s *Service) Stop() error

func (*Service) SubscribeMinConsensusInfoEvent

func (s *Service) SubscribeMinConsensusInfoEvent(ch chan<- *types.MinimalEpochConsensusInfo) event.Subscription

SubscribeChainHeadEvent registers a subscription of ChainHeadEvent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL