api

package
v0.2012.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 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 Scheduler

type Scheduler interface {
	// Name is the scheduler algorithm name.
	Name() string

	// Initialize initializes the internal scheduler state.
	// Scheduler should use the provided transaction dispatcher to dispatch
	// transactions.
	Initialize(td TransactionDispatcher) error

	// IsInitialized returns true, if the scheduler has been initialized.
	IsInitialized() bool

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

	// AppendTxBatch appends a transaction batch for scheduling.
	//
	// Note: the AppendTxBatch is not required to be atomic. Semantics depend
	// on the specific scheduler implementation.
	AppendTxBatch(batch [][]byte) error

	// RemoveTxBatch removes a transaction batch.
	RemoveTxBatch(tx [][]byte) error

	// Flush flushes queued transactions.
	Flush(force bool) error

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

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

	// UpdateParameters updates the scheduling parameters.
	UpdateParameters(registry.TxnSchedulerParameters) error

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

Scheduler defines an algorithm for scheduling incoming transactions.

type TransactionDispatcher

type TransactionDispatcher interface {
	// Dispatch attempts to dispatch a batch to a executor committee.
	Dispatch(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