types

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeEventManager

type BridgeEventManager struct {
	// Exclusive mutex taken when reading or writing
	sync.Mutex
	// contains filtered or unexported fields
}

BridgeEventManager maintains a map of "Recognized" Bridge Events. That is, events that have been finalized on Ethereum but are not yet in consensus on the V4 chain. Methods are goroutine safe.

func NewBridgeEventManager

func NewBridgeEventManager(
	timeProvider libtime.TimeProvider,
) *BridgeEventManager

NewBridgeEventManager creates a new BridgeEventManager.

func (*BridgeEventManager) AddBridgeEvents

func (b *BridgeEventManager) AddBridgeEvents(
	events []types.BridgeEvent,
) error

AddBridgeEvents adds bridge events to the manager (with timestamps). Added events must have contiguous and in-order IDs. Any events with ID less than the `recognizedEventInfo.NextId` are ignored.

func (*BridgeEventManager) GetBridgeEventById

func (b *BridgeEventManager) GetBridgeEventById(
	id uint32,
) (
	event types.BridgeEvent,
	timestamp time.Time,
	found bool,
)

GetBridgeEventById returns a bridge event by ID. Found is false if the manager does not have the event.

func (*BridgeEventManager) GetNow

func (b *BridgeEventManager) GetNow() time.Time

func (*BridgeEventManager) GetRecognizedEventInfo

func (b *BridgeEventManager) GetRecognizedEventInfo() types.BridgeEventInfo

GetRecognizedEventInfo returns `recognizedEventInfo`.

func (*BridgeEventManager) SetRecognizedEventInfo

func (b *BridgeEventManager) SetRecognizedEventInfo(
	eventInfo types.BridgeEventInfo,
) error

SetRecognizedEventInfo sets `recognizedEventInfo`. An error is returned and no update occurs if `NextId` or `EthBlockHeight` is lesser than its existing value.

type BridgeEventWithTime

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

BridgeEventWithTime is a type that wraps BridgeEvent but also holds an additional timestamp.

type EventId

type EventId = uint32

Jump to

Keyboard shortcuts

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