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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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