blockdag

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		BlockAttached:        event.New1[*blocks.Block](),
		BlockSolid:           event.New1[*blocks.Block](),
		BlockMissing:         event.New1[*blocks.Block](),
		MissingBlockAttached: event.New1[*blocks.Block](),
		BlockInvalid:         event.New2[*blocks.Block, error](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type BlockDAG

type BlockDAG interface {
	// Attach is used to attach new Blocks to the BlockDAG. It is the main function of the BlockDAG that triggers Events.
	Attach(data *model.Block) (block *blocks.Block, wasAttached bool, err error)

	// GetOrRequestBlock returns the Block with the given BlockID from the BlockDAG (and requests it from the network if
	// it is missing). If the requested Block is below the eviction threshold, then this method will return a nil block
	// without requesting it.
	GetOrRequestBlock(blockID iotago.BlockID) (block *blocks.Block, requested bool)

	// Reset resets the component to a clean state as if it was created at the last commitment.
	Reset()

	log.Logger

	module.Interface
}

type Events

type Events struct {
	// BlockAttached is triggered when a previously unknown Block is attached.
	BlockAttached *event.Event1[*blocks.Block]

	// BlockSolid is triggered when a Block becomes solid (its entire past cone is known and solid).
	BlockSolid *event.Event1[*blocks.Block]

	// BlockMissing is triggered when a referenced Block was not attached, yet.
	BlockMissing *event.Event1[*blocks.Block]

	// MissingBlockAttached is triggered when a previously missing Block was attached.
	MissingBlockAttached *event.Event1[*blocks.Block]

	// BlockInvalid is triggered when a Block is found to be invalid.
	BlockInvalid *event.Event2[*blocks.Block, error]

	event.Group[Events, *Events]
}

Events is a collection of Tangle related Events.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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