interceptors

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEpochStartMetaBlockInterceptor added in v1.2.0

func NewEpochStartMetaBlockInterceptor(args ArgsEpochStartMetaBlockInterceptor) (*epochStartMetaBlockInterceptor, error)

NewEpochStartMetaBlockInterceptor returns a new instance of epochStartMetaBlockInterceptor

func NewWhiteListDataVerifier added in v1.0.102

func NewWhiteListDataVerifier(cacher storage.Cacher) (*whiteListDataVerifier, error)

NewWhiteListDataVerifier returns a default data verifier

Types

type ArgMultiDataInterceptor added in v1.1.1

type ArgMultiDataInterceptor struct {
	Topic                string
	Marshalizer          marshal.Marshalizer
	DataFactory          process.InterceptedDataFactory
	Processor            process.InterceptorProcessor
	Throttler            process.InterceptorThrottler
	AntifloodHandler     process.P2PAntifloodHandler
	WhiteListRequest     process.WhiteListHandler
	PreferredPeersHolder process.PreferredPeersHolderHandler
	CurrentPeerId        core.PeerID
}

ArgMultiDataInterceptor is the argument for the multi-data interceptor

type ArgSingleDataInterceptor added in v1.1.1

type ArgSingleDataInterceptor struct {
	Topic                string
	DataFactory          process.InterceptedDataFactory
	Processor            process.InterceptorProcessor
	Throttler            process.InterceptorThrottler
	AntifloodHandler     process.P2PAntifloodHandler
	WhiteListRequest     process.WhiteListHandler
	PreferredPeersHolder process.PreferredPeersHolderHandler
	CurrentPeerId        core.PeerID
}

ArgSingleDataInterceptor is the argument for the single-data interceptor

type ArgsEpochStartMetaBlockInterceptor added in v1.2.0

type ArgsEpochStartMetaBlockInterceptor struct {
	Marshalizer               marshal.Marshalizer
	Hasher                    hashing.Hasher
	NumConnectedPeersProvider process.NumConnectedPeersProvider
	ConsensusPercentage       int
}

ArgsEpochStartMetaBlockInterceptor holds the arguments needed for creating a new epochStartMetaBlockInterceptor

type MultiDataInterceptor

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

MultiDataInterceptor is used for intercepting packed multi data

func NewMultiDataInterceptor

func NewMultiDataInterceptor(arg ArgMultiDataInterceptor) (*MultiDataInterceptor, error)

NewMultiDataInterceptor hooks a new interceptor for packed multi data

func (*MultiDataInterceptor) Close added in v1.2.4

func (mdi *MultiDataInterceptor) Close() error

Close will call the chunk processor's close method

func (*MultiDataInterceptor) IsInterfaceNil

func (mdi *MultiDataInterceptor) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MultiDataInterceptor) ProcessReceivedMessage

func (mdi *MultiDataInterceptor) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error

ProcessReceivedMessage is 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)

func (*MultiDataInterceptor) RegisterHandler added in v1.0.133

func (mdi *MultiDataInterceptor) RegisterHandler(handler func(topic string, hash []byte, data interface{}))

RegisterHandler registers a callback function to be notified on received data

func (*MultiDataInterceptor) SetChunkProcessor added in v1.2.4

func (mdi *MultiDataInterceptor) SetChunkProcessor(processor process.InterceptedChunksProcessor) error

SetChunkProcessor sets the intercepted chunks processor

func (MultiDataInterceptor) SetInterceptedDebugHandler added in v1.0.110

func (bdi MultiDataInterceptor) SetInterceptedDebugHandler(handler process.InterceptedDebugger) error

SetInterceptedDebugHandler will set a new intercepted debug handler

type SingleDataInterceptor

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

SingleDataInterceptor is used for intercepting packed multi data

func NewSingleDataInterceptor

func NewSingleDataInterceptor(arg ArgSingleDataInterceptor) (*SingleDataInterceptor, error)

NewSingleDataInterceptor hooks a new interceptor for single data

func (*SingleDataInterceptor) Close added in v1.2.4

func (sdi *SingleDataInterceptor) Close() error

Close returns nil

func (*SingleDataInterceptor) IsInterfaceNil

func (sdi *SingleDataInterceptor) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SingleDataInterceptor) ProcessReceivedMessage

func (sdi *SingleDataInterceptor) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error

ProcessReceivedMessage is 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)

func (*SingleDataInterceptor) RegisterHandler added in v1.0.133

func (sdi *SingleDataInterceptor) RegisterHandler(handler func(topic string, hash []byte, data interface{}))

RegisterHandler registers a callback function to be notified on received data

func (SingleDataInterceptor) SetInterceptedDebugHandler added in v1.0.110

func (bdi SingleDataInterceptor) SetInterceptedDebugHandler(handler process.InterceptedDebugger) error

SetInterceptedDebugHandler will set a new intercepted debug handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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