api

package
v0.20.9 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package api implements the transaction scheduler algorithm API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm interface {
	// Initialize initializes the internal transaction scheduler state.
	// Algorithm should use the provided transaction dispatcher to dispatch
	// scheduled transactions.
	Initialize(td TransactionDispatcher) error

	// IsInitialized returns true, if an algorithm has been initialized.
	IsInitialized() bool

	// EpochTransition notifies the transaction scheduler about a new
	// epoch transition, passing in an epoch snapshot.
	EpochTransition(epoch *committee.EpochSnapshot) error

	// ScheduleTx attempts to schedule a transaction.
	//
	// The scheduling algorithm may peek into the transaction to extract
	// metadata needed for scheduling. In this case, the transaction bytes
	// must correspond to a transaction.TxnCall structure.
	ScheduleTx(tx []byte) error

	// Flush flushes queued transactions.
	Flush() error

	// UnscheduledSize returns number of unscheduled items.
	UnscheduledSize() int

	// IsQueued returns if a transaction is queued.
	IsQueued(hash.Hash) bool

	// Clear clears the transaction queue.
	Clear()
}

Algorithm defines an algorithm for scheduling incoming transaction.

type TransactionDispatcher

type TransactionDispatcher interface {
	// Dispatch attempts to dispatch a batch to a executor committee.
	Dispatch(committeeID hash.Hash, batch transaction.RawBatch) error
}

TransactionDispatcher dispatches transactions to a scheduled executor committee.

Jump to

Keyboard shortcuts

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