listener

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListenerServiceStr = "listener"

	RootChainListenerStr  = "rootchain"
	HeimdallListenerStr   = "heimdall"
	MaticChainListenerStr = "maticchain"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseListener

type BaseListener struct {
	Logger log.Logger

	// header channel
	HeaderChannel chan *types.Header
	// contains filtered or unexported fields
}

func NewBaseListener

func NewBaseListener(cdc *codec.Codec, queueConnector *queue.QueueConnector, httpClient *httpClient.HTTP, chainClient *ethclient.Client, name string, impl Listener) *BaseListener

NewBaseListener creates a new BaseListener.

func (*BaseListener) StartHeaderProcess

func (bl *BaseListener) StartHeaderProcess(ctx context.Context)

startHeaderProcess starts header process when they get new header

func (*BaseListener) StartPolling

func (bl *BaseListener) StartPolling(ctx context.Context, pollInterval time.Duration)

startPolling starts polling

func (*BaseListener) StartSubscription

func (bl *BaseListener) StartSubscription(ctx context.Context, subscription ethereum.Subscription)

func (*BaseListener) Stop

func (bl *BaseListener) Stop()

OnStop stops all necessary go routines

func (*BaseListener) String

func (bl *BaseListener) String() string

String implements Service by returning a string representation of the service.

type HeimdallListener

type HeimdallListener struct {
	BaseListener
}

HeimdallListener - Listens to and process events from heimdall

func NewHeimdallListener

func NewHeimdallListener() *HeimdallListener

NewHeimdallListener - constructor func

func (*HeimdallListener) ProcessBlockEvent

func (hl *HeimdallListener) ProcessBlockEvent(event sdk.StringEvent, blockHeight int64)

ProcessBlockEvent - process Blockevents (BeginBlock, EndBlock events) from heimdall.

func (*HeimdallListener) ProcessHeader

func (hl *HeimdallListener) ProcessHeader(*types.Header)

ProcessHeader -

func (*HeimdallListener) Start

func (hl *HeimdallListener) Start() error

Start starts new block subscription

func (*HeimdallListener) StartPolling

func (hl *HeimdallListener) StartPolling(ctx context.Context, pollInterval time.Duration)

StartPolling - starts polling for heimdall events

type Listener

type Listener interface {
	Start() error

	StartHeaderProcess(context.Context)

	StartPolling(context.Context, time.Duration)

	StartSubscription(context.Context, ethereum.Subscription)

	ProcessHeader(*types.Header)

	Stop()

	String() string
}

Listener defines a block header listerner for Rootchain, Maticchain, Heimdall

type ListenerService

type ListenerService struct {
	// Base service
	common.BaseService
	// contains filtered or unexported fields
}

ListenerService starts and stops all chain event listeners

func NewListenerService

func NewListenerService(cdc *codec.Codec, queueConnector *queue.QueueConnector, httpClient *httpClient.HTTP) *ListenerService

NewListenerService returns new service object for listneing to events

func (*ListenerService) OnStart

func (listenerService *ListenerService) OnStart() error

OnStart starts new block subscription

func (*ListenerService) OnStop

func (listenerService *ListenerService) OnStop()

OnStop stops all necessary go routines

type MaticChainListener

type MaticChainListener struct {
	BaseListener
}

MaticChainListener - Listens to and process headerblocks from maticchain

func NewMaticChainListener

func NewMaticChainListener() *MaticChainListener

NewMaticChainListener - constructor func

func (*MaticChainListener) ProcessHeader

func (ml *MaticChainListener) ProcessHeader(newHeader *types.Header)

ProcessHeader - process headerblock from maticchain

func (*MaticChainListener) Start

func (ml *MaticChainListener) Start() error

Start starts new block subscription

type RootChainListener

type RootChainListener struct {
	BaseListener
	// contains filtered or unexported fields
}

RootChainListener - Listens to and process events from rootchain

func NewRootChainListener

func NewRootChainListener() *RootChainListener

NewRootChainListener - constructor func

func (*RootChainListener) ProcessHeader

func (rl *RootChainListener) ProcessHeader(newHeader *types.Header)

ProcessHeader - process headerblock from rootchain

func (*RootChainListener) Start

func (rl *RootChainListener) Start() error

Start starts new block subscription

type RootChainListenerContext

type RootChainListenerContext struct {
	ChainmanagerParams *chainmanagerTypes.Params
}

RootChainListenerContext root chain listener context

Jump to

Keyboard shortcuts

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