events

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ForkDetected    = &Feed{}                 // Found a block that indicates fork.
	NewChainHead    = &FeedOf[*types.Block]{} // Chain switched to a new head block.
	NewMinedBlock   = &FeedOf[*types.Block]{} // A new block is mined into current chain
	NewNetworkBlock = &FeedOf[BlockWithTd]{}  // A new block recieved from network
	NewNetworkTx    = &FeedOf[types.Tx]{}
	NewTx           = &FeedOf[types.Tx]{}
	SyncStarted     = &Feed{}
	SyncFinished    = &Feed{}
)

Functions

This section is empty.

Types

type BlockWithTd added in v0.0.3

type BlockWithTd struct {
	*types.Block
	Td *big.Int
}

type Callback

type Callback[T any] func(data T)

type Feed added in v0.2.0

type Feed struct {
	FeedOf[struct{}]
}

Event feed without data.

func (*Feed) Send added in v0.2.0

func (f *Feed) Send() (sent int)

func (*Feed) Subscribe added in v0.2.0

func (f *Feed) Subscribe(id string, callback func())

func (*Feed) Unsubscribe added in v0.2.0

func (f *Feed) Unsubscribe(id string) *sync.WaitGroup

type FeedOf

type FeedOf[T any] struct {
	// contains filtered or unexported fields
}

Event feed with data of type T.

Wrapper of go-ethereum/event.FeedOf that provides easier Subscribe and Unsubscribe calls

func (*FeedOf[T]) Send

func (e *FeedOf[T]) Send(data T) (sent int)

func (*FeedOf[T]) Subscribe

func (e *FeedOf[T]) Subscribe(id string, callback Callback[T])

func (*FeedOf[T]) Unsubscribe

func (e *FeedOf[T]) Unsubscribe(id string) *sync.WaitGroup

type Subscription

type Subscription[T any] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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