observer

package
v0.0.0-...-8acb6f8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultObserverLevelDBFolder = `observer_data`

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressManager

type AddressManager struct {
	// contains filtered or unexported fields
}

AddressManager it manage the pool address

func NewAddressManager

func NewAddressManager(chainHost string, m *metrics.Metrics) (*AddressManager, error)

NewAddressManager create a new instance of AddressManager

func (*AddressManager) AddPubKey

func (pam *AddressManager) AddPubKey(pk common.PubKeys)

func (*AddressManager) IsValidAddress

func (pam *AddressManager) IsValidAddress(addr string, chain common.Chain) bool

IsValidAddress check whether the given address is a monitored address

func (*AddressManager) IsValidPoolAddress

func (pam *AddressManager) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)

IsValidPoolAddress check whether the given address is a pool addr

func (*AddressManager) RemovePubKey

func (pam *AddressManager) RemovePubKey(pk common.PubKeys)

func (*AddressManager) Start

func (pam *AddressManager) Start() error

Start to poll poll addresses from statechain

func (*AddressManager) Stop

func (pam *AddressManager) Stop() error

Stop pool address manager

type AddressValidator

type AddressValidator interface {
	IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)
	IsValidAddress(addr string, chain common.Chain) bool
	AddPubKey(pk common.PubKeys)
	RemovePubKey(pk common.PubKeys)
}

type BinanceBlockScanner

type BinanceBlockScanner struct {
	// contains filtered or unexported fields
}

BinanceBlockScanner is to scan the blocks

func NewBinanceBlockScanner

func NewBinanceBlockScanner(cfg config.BlockScannerConfiguration, scanStorage blockscanner.ScannerStorage, isTestNet bool, addrVal AddressValidator, m *metrics.Metrics) (*BinanceBlockScanner, error)

NewBinanceBlockScanner create a new instance of BlockScan

func (*BinanceBlockScanner) GetMessages

func (b *BinanceBlockScanner) GetMessages() <-chan stypes.TxIn

GetMessages return the channel

func (*BinanceBlockScanner) Start

func (b *BinanceBlockScanner) Start()

Start block scanner

func (*BinanceBlockScanner) Stop

func (b *BinanceBlockScanner) Stop() error

type BinanceChanBlockScannerStorage

type BinanceChanBlockScannerStorage struct {
	*blockscanner.LevelDBScannerStorage
	// contains filtered or unexported fields
}

func NewBinanceChanBlockScannerStorage

func NewBinanceChanBlockScannerStorage(levelDbFolder string) (*BinanceChanBlockScannerStorage, error)

func (*BinanceChanBlockScannerStorage) Close

func (ldbss *BinanceChanBlockScannerStorage) Close() error

Close underlying db

func (*BinanceChanBlockScannerStorage) GetTxInForRetry

func (ldbss *BinanceChanBlockScannerStorage) GetTxInForRetry(failedOnly bool) ([]types.TxIn, error)

GetTxInForRetry retrieve all txin that had been failed before to retry

func (*BinanceChanBlockScannerStorage) RemoveTxIn

func (ldbss *BinanceChanBlockScannerStorage) RemoveTxIn(txin types.TxIn) error

RemoveTxIn remove the given txin from the store

func (*BinanceChanBlockScannerStorage) SetTxInStatus

func (ldbss *BinanceChanBlockScannerStorage) SetTxInStatus(txIn types.TxIn, status types.TxInStatus) error

SetTxInStatus set the given txin to a status , in the data store

type MockPoolAddressValidator

type MockPoolAddressValidator struct {
	// contains filtered or unexported fields
}

func NewMockPoolAddressValidator

func NewMockPoolAddressValidator() *MockPoolAddressValidator

func (*MockPoolAddressValidator) AddPubKey

func (mpa *MockPoolAddressValidator) AddPubKey(pk common.PubKeys)

func (*MockPoolAddressValidator) IsValidAddress

func (mpa *MockPoolAddressValidator) IsValidAddress(addr string, chain common.Chain) bool

func (*MockPoolAddressValidator) IsValidPoolAddress

func (mpa *MockPoolAddressValidator) IsValidPoolAddress(addr string, chain common.Chain) (bool, common.ChainPoolInfo)

func (*MockPoolAddressValidator) RemovePubKey

func (mpa *MockPoolAddressValidator) RemovePubKey(pk common.PubKeys)

type Observer

type Observer struct {
	// contains filtered or unexported fields
}

Observer observer service

func NewObserver

func NewObserver(cfg config.Configuration) (*Observer, error)

NewObserver create a new instance of Observer

func (*Observer) Start

func (o *Observer) Start() error

func (*Observer) Stop

func (o *Observer) Stop() error

Stop the observer

type TxInStatusItem

type TxInStatusItem struct {
	TxIn   types.TxIn       `json:"tx_in"`
	Status types.TxInStatus `json:"status"`
}

TxInStatusItem represent the TxIn item status

type TxInStorage

type TxInStorage interface {
	SetTxInStatus(types.TxIn, types.TxInStatus) error
	RemoveTxIn(types.TxIn) error
	GetTxInForRetry(failedOnly bool) ([]types.TxIn, error)
}

TxInStorage define method used by observer

Jump to

Keyboard shortcuts

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