execute

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 20 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)

	// DidUpdateValidators indicates that this block updated the validator set.
	DidUpdateValidators() ([]*ValidatorUpdate, 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 DescribeShim added in v1.3.0

type DescribeShim struct {
	NetworkType protocol.PartitionType
	PartitionId string
}

func (*DescribeShim) AnchorPool added in v1.3.0

func (n *DescribeShim) AnchorPool() *url.URL

AnchorPool returns the URL of the partition's anchor pool.

func (*DescribeShim) BlockLedger added in v1.3.0

func (n *DescribeShim) BlockLedger(i uint64) *url.URL

BlockLedger returns the URL of a partition's ledger for a block.

func (*DescribeShim) Ledger added in v1.3.0

func (n *DescribeShim) Ledger() *url.URL

Ledger returns the URL of the partition's ledger account.

func (*DescribeShim) NodeUrl added in v1.3.0

func (n *DescribeShim) NodeUrl(path ...string) *url.URL

NodeUrl returns the URL of the partition, optionally with a path appended.

func (*DescribeShim) Operators added in v1.3.0

func (n *DescribeShim) Operators() *url.URL

Operators returns the URL of the partition's operator key book.

func (*DescribeShim) OperatorsPage added in v1.3.0

func (n *DescribeShim) OperatorsPage() *url.URL

OperatorsPage returns the URL of the default page of the partition's operator key book.

func (*DescribeShim) PartitionUrl added in v1.3.0

func (n *DescribeShim) PartitionUrl() config.NetworkUrl

PartitionUrl returns a NetworkUrl for the local partition.

func (*DescribeShim) Synthetic added in v1.3.0

func (n *DescribeShim) Synthetic() *url.URL

Synthetic returns the URL of the partition's ledger account.

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               DescribeShim                       // 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
}

func DiffValidators added in v1.3.0

func DiffValidators(g, h *network.GlobalValues, partitionID string) []*ValidatorUpdate

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