blockhandler

package
v1.0.0-alpha.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockAttacherInvalidBlock              = ierrors.New("invalid block")
	ErrBlockAttacherAttachingNotPossible      = ierrors.New("attaching not possible")
	ErrBlockAttacherIncompleteBlockNotAllowed = ierrors.New("incomplete block is not allowed on this node")
)
View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		BlockSubmitted: event.New1[*model.Block](),
		Error:          event.New1[error](),
	}
})

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

Functions

This section is empty.

Types

type BlockHandler

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

BlockHandler contains the logic to attach blocks to the Tangle and await for it to be processed.

func New

func (*BlockHandler) AttachBlock

func (i *BlockHandler) AttachBlock(ctx context.Context, iotaBlock *iotago.Block) (iotago.BlockID, error)

func (*BlockHandler) Shutdown

func (i *BlockHandler) Shutdown()

Shutdown shuts down the block issuer.

func (*BlockHandler) SubmitBlock

func (i *BlockHandler) SubmitBlock(block *model.Block) error

SubmitBlock submits a block to be processed.

func (*BlockHandler) SubmitBlockAndAwaitEvent

func (i *BlockHandler) SubmitBlockAndAwaitEvent(ctx context.Context, block *model.Block, evt *event.Event1[*blocks.Block]) error

SubmitBlockAndAwaitEvent submits a block to be processed and waits for the event to be triggered.

type Events

type Events struct {
	// Triggered when a block is submitted, i.e. sent to the protocol to be processed.
	BlockSubmitted *event.Event1[*model.Block]

	// Fired when an error occurred.
	Error *event.Event1[error]

	event.Group[Events, *Events]
}

Events represents events happening on a block factory.

Jump to

Keyboard shortcuts

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