execute

package
v1.2.10-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabaseObserver

func NewDatabaseObserver() database.Observer

Types

type Block

type Block interface {
	// Params returns the parameters the block was created with.
	Params() BlockParams

	// Process processes a set of messages.
	Process(envelope *messaging.Envelope) ([]*protocol.TransactionStatus, error)

	// Close closes the block and returns the end state of the block.
	Close() (BlockState, error)
}

A Block is the context in which messages are processed.

type BlockParams

type BlockParams struct {
	Context    context.Context
	IsLeader   bool
	Index      uint64
	Time       time.Time
	CommitInfo *abcitypes.CommitInfo
	Evidence   []abcitypes.Misbehavior
}

BlockParams are the parameters for a new Block.

type BlockState

type BlockState interface {
	// Params returns the parameters the block was created with.
	Params() BlockParams

	// IsEmpty indicates that nothing happened in this block.
	IsEmpty() bool

	// DidCompleteMajorBlock indicates that this block completed a major block.
	DidCompleteMajorBlock() (uint64, time.Time, bool)

	// ChangeSet is the database batch.
	ChangeSet() record.Record

	// Hash returns the block hash.
	Hash() ([32]byte, error)

	// Commit commits changes made by this block.
	Commit() error

	// Discard discards changes made by this block.
	Discard()
}

BlockState is the state of a completed block.

type Dispatcher

type Dispatcher interface {
	// Submit adds an envelope to the queue.
	Submit(ctx context.Context, dest *url.URL, envelope *messaging.Envelope) error

	// Send submits the queued transactions.
	Send(context.Context) <-chan error
}

A Dispatcher dispatches synthetic transactions produced by the executor.

type Executor

type Executor interface {
	EnableTimers()
	StoreBlockTimers(ds *logging.DataSet)

	// LastBlock returns the height and hash of the last block.
	LastBlock() (*BlockParams, [32]byte, error)

	// Init must be called after the database is initialized from the genesis
	// snapshot. Init validates the initial validators and returns any
	// additional validators.
	Init(validators []*ValidatorUpdate) (additional []*ValidatorUpdate, err error)

	// Validate validates a set of messages.
	Validate(envelope *messaging.Envelope, recheck bool) ([]*protocol.TransactionStatus, error)

	// Begin begins a Tendermint block.
	Begin(BlockParams) (Block, error)
}

An Executor creates blocks and executes messages.

type Options

type Options struct {
	Logger                 log.Logger                         //
	Database               database.Beginner                  //
	Key                    ed25519.PrivateKey                 // Private validator key
	Router                 routing.Router                     //
	Describe               config.Describe                    // Network description
	EventBus               *events.Bus                        //
	MajorBlockScheduler    blockscheduler.MajorBlockScheduler //
	BackgroundTaskLauncher func(func())                       // Background task launcher
	NewDispatcher          func() Dispatcher                  // Synthetic transaction dispatcher factory
	Sequencer              private.Sequencer                  // Synthetic and anchor sequence API service
	Querier                api.Querier                        // Query API service
	EnableHealing          bool                               //
}

Options are the options for constructing an Executor

type ValidatorUpdate

type ValidatorUpdate struct {
	Type      protocol.SignatureType
	PublicKey []byte
	Power     int64
}

type WillBeginBlock

type WillBeginBlock struct {
	BlockParams
}

func (WillBeginBlock) IsEvent

func (WillBeginBlock) IsEvent()

type WillCommitBlock

type WillCommitBlock struct {
	Block BlockState
}

func (WillCommitBlock) IsEvent

func (WillCommitBlock) IsEvent()

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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