interceptors

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeaderInterceptor

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

HeaderInterceptor represents an interceptor used for block headers

func NewHeaderInterceptor

func NewHeaderInterceptor(
	marshalizer marshal.Marshalizer,
	headers storage.Cacher,
	headersNonces dataRetriever.Uint64SyncMapCacher,
	storer storage.Storer,
	multiSigVerifier crypto.MultiSigVerifier,
	hasher hashing.Hasher,
	shardCoordinator sharding.Coordinator,
	chronologyValidator process.ChronologyValidator,
) (*HeaderInterceptor, error)

NewHeaderInterceptor hooks a new interceptor for block headers Fetched block headers will be placed in a data pool

func (*HeaderInterceptor) ProcessReceivedMessage

func (hi *HeaderInterceptor) ProcessReceivedMessage(message p2p.MessageP2P) error

ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received (for the topic this validator was registered to)

type HeaderInterceptorBase

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

HeaderInterceptorBase is the "abstract class" extended in HeaderInterceptor and ShardHeaderInterceptor

func NewHeaderInterceptorBase

func NewHeaderInterceptorBase(
	marshalizer marshal.Marshalizer,
	storer storage.Storer,
	multiSigVerifier crypto.MultiSigVerifier,
	hasher hashing.Hasher,
	shardCoordinator sharding.Coordinator,
	chronologyValidator process.ChronologyValidator,
) (*HeaderInterceptorBase, error)

NewHeaderInterceptorBase creates a new HeaderIncterceptorBase instance

func (*HeaderInterceptorBase) CheckHeaderForCurrentShard

func (hib *HeaderInterceptorBase) CheckHeaderForCurrentShard(interceptedHdr *block.InterceptedHeader) bool

CheckHeaderForCurrentShard checks if the header is for current shard

func (*HeaderInterceptorBase) ParseReceivedMessage

func (hib *HeaderInterceptorBase) ParseReceivedMessage(message p2p.MessageP2P) (*block.InterceptedHeader, error)

ParseReceivedMessage will transform the received p2p.Message in an InterceptedHeader. If the header hash is present in storage it will output an error

type MetachainHeaderInterceptor

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

MetachainHeaderInterceptor represents an interceptor used for metachain block headers

func NewMetachainHeaderInterceptor

func NewMetachainHeaderInterceptor(
	marshalizer marshal.Marshalizer,
	metachainHeaders storage.Cacher,
	metachainHeadersNonces dataRetriever.Uint64SyncMapCacher,
	storer storage.Storer,
	multiSigVerifier crypto.MultiSigVerifier,
	hasher hashing.Hasher,
	shardCoordinator sharding.Coordinator,
	chronologyValidator process.ChronologyValidator,
) (*MetachainHeaderInterceptor, error)

NewMetachainHeaderInterceptor hooks a new interceptor for metachain block headers Fetched metachain block headers will be placed in a data pool

func (*MetachainHeaderInterceptor) ProcessReceivedMessage

func (mhi *MetachainHeaderInterceptor) ProcessReceivedMessage(message p2p.MessageP2P) error

ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received (for the topic this validator was registered to)

type PeerBlockBodyInterceptor

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

PeerBlockBodyInterceptor represents an interceptor used for peer changes block bodies

func NewPeerBlockBodyInterceptor

func NewPeerBlockBodyInterceptor(
	marshalizer marshal.Marshalizer,
	cache storage.Cacher,
	storer storage.Storer,
	hasher hashing.Hasher,
	shardCoordinator sharding.Coordinator,
) (*PeerBlockBodyInterceptor, error)

NewPeerBlockBodyInterceptor creates a new instance of a TxBlockBodyInterceptor

func (*PeerBlockBodyInterceptor) ProcessReceivedMessage

func (pbbi *PeerBlockBodyInterceptor) ProcessReceivedMessage(message p2p.MessageP2P) error

ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received (for the topic this validator was registered to)

type TxBlockBodyInterceptor

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

TxBlockBodyInterceptor represents an interceptor used for transaction block bodies

func NewTxBlockBodyInterceptor

func NewTxBlockBodyInterceptor(
	marshalizer marshal.Marshalizer,
	cache storage.Cacher,
	storer storage.Storer,
	hasher hashing.Hasher,
	shardCoordinator sharding.Coordinator,
) (*TxBlockBodyInterceptor, error)

NewTxBlockBodyInterceptor creates a new instance of a TxBlockBodyInterceptor

func (*TxBlockBodyInterceptor) ProcessReceivedMessage

func (tbbi *TxBlockBodyInterceptor) ProcessReceivedMessage(message p2p.MessageP2P) error

ProcessReceivedMessage will be the callback func from the p2p.Messenger and will be called each time a new message was received (for the topic this validator was registered to)

Jump to

Keyboard shortcuts

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