execute

package
v1.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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

	// Process processes a set of messages.
	Process([]messaging.Message) ([]*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)

	// 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, env *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)

	// LoadStateRoot returns the BPT root hash.
	LoadStateRoot(*database.Batch) ([]byte, error)

	// RestoreSnapshot restores the database from a snapshot.
	RestoreSnapshot(database.Beginner, ioutil2.SectionReader) error

	// InitChainValidators validates the given initial validators and returns
	// any additional validators.
	InitChainValidators(initVal []abcitypes.ValidatorUpdate) (additional [][]byte, err error)

	// Validate validates a set of messages.
	Validate(*database.Batch, []messaging.Message) ([]*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
}

Options are the options for constructing an Executor

Directories

Path Synopsis
v1
v2

Jump to

Keyboard shortcuts

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