blockdag

package
v1.0.0-alpha.24 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

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