blockdag

package
v1.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 5 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 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()

	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