blockdag

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 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{
		BlockAppended:        event.New1[*blocks.Block](),
		BlockSolid:           event.New1[*blocks.Block](),
		BlockMissing:         event.New1[*blocks.Block](),
		MissingBlockAppended: 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 {
	// Append is used to append new Blocks to the BlockDAG. It is the main function of the BlockDAG that triggers Events.
	Append(modelBlock *model.Block) (block *blocks.Block, wasAppended 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.Module
}

type Events

type Events struct {
	// BlockAppended is triggered when a previously unknown Block is appended to the block DAG.
	BlockAppended *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 appended, yet.
	BlockMissing *event.Event1[*blocks.Block]

	// MissingBlockAppended is triggered when a previously missing Block was appended.
	MissingBlockAppended *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