async

package
v1.5.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT, MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncGossiper

type AsyncGossiper interface {
	Gossip(payload *eth.ExecutionPayloadEnvelope)
	Get() *eth.ExecutionPayloadEnvelope
	Clear()
	Stop()
	Start()
}

type Metrics

type Metrics interface {
	RecordPublishingError()
}

To avoid import cycles, we define a new Metrics interface here this interface is compatable with driver.Metrics

type Network

type Network interface {
	PublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
}

To avoid import cycles, we define a new Network interface here this interface is compatable with driver.Network

type NoOpGossiper

type NoOpGossiper struct{}

NoOpGossiper is a no-op implementation of AsyncGossiper it serves as a placeholder for when the AsyncGossiper is not needed

func (NoOpGossiper) Clear

func (NoOpGossiper) Clear()

func (NoOpGossiper) Get

func (NoOpGossiper) Gossip

func (NoOpGossiper) Gossip(payload *eth.ExecutionPayloadEnvelope)

func (NoOpGossiper) Start

func (NoOpGossiper) Start()

func (NoOpGossiper) Stop

func (NoOpGossiper) Stop()

type SimpleAsyncGossiper

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

SimpleAsyncGossiper is a component that stores and gossips a single payload at a time it uses a separate goroutine to handle gossiping the payload asynchronously the payload can be accessed by the Get function to be reused when the payload was gossiped but not inserted exposed functions are synchronous, and block until the async routine is able to start handling the request

func NewAsyncGossiper

func NewAsyncGossiper(ctx context.Context, net Network, log log.Logger, metrics Metrics) *SimpleAsyncGossiper

func (*SimpleAsyncGossiper) Clear

func (p *SimpleAsyncGossiper) Clear()

Clear is a synchronous function to clear the currently gossiping payload it blocks until the signal to clear is picked up by the async routine

func (*SimpleAsyncGossiper) Get

Get is a synchronous function to get the currently held payload it blocks until the async routine is able to return the payload

func (*SimpleAsyncGossiper) Gossip

func (p *SimpleAsyncGossiper) Gossip(payload *eth.ExecutionPayloadEnvelope)

Gossip is a synchronous function to store and gossip a payload it blocks until the payload can be taken by the async routine

func (*SimpleAsyncGossiper) Start

func (p *SimpleAsyncGossiper) Start()

Start starts the AsyncGossiper's gossiping loop on a separate goroutine each behavior of the loop is handled by a select case on a channel, plus an internal handler function call

func (*SimpleAsyncGossiper) Stop

func (p *SimpleAsyncGossiper) Stop()

Stop is a synchronous function to stop the async routine it blocks until the async routine accepts the signal

Jump to

Keyboard shortcuts

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