queue

package
v0.0.0-...-adbc7b5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2018 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTxQueueCap defines how many items can be queued.
	DefaultTxQueueCap = int(35)
)

Variables

View Source
var (
	// ErrQueuedTxExist - transaction was already enqueued
	ErrQueuedTxExist = errors.New("transaction already exist in queue")
	//ErrQueuedTxIDNotFound - error transaction hash not found
	ErrQueuedTxIDNotFound = errors.New("transaction hash not found")
	//ErrQueuedTxInProgress - error transaction is in progress
	ErrQueuedTxInProgress = errors.New("transaction is in progress")
	//ErrInvalidCompleteTxSender - error transaction with invalid sender
	ErrInvalidCompleteTxSender = errors.New("transaction can only be completed by the same account which created it")
)
View Source
var ErrTxQueueRunFailure = errors.New("error running transaction queue")

ErrTxQueueRunFailure - error running transaction queue

Functions

func HaltOnPanic

func HaltOnPanic()

HaltOnPanic recovers from panic, logs issue, sends upward notification, and exits

Types

type TxQueue

type TxQueue struct {
	// contains filtered or unexported fields
}

TxQueue is capped container that holds pending transactions

func New

func New() *TxQueue

New creates a transaction queue.

func (*TxQueue) Count

func (q *TxQueue) Count() int

Count returns number of currently queued transactions

func (*TxQueue) Done

func (q *TxQueue) Done(id common.QueuedTxID, hash gethcommon.Hash, err error) error

Done removes transaction from queue if no error or error is not transient and notify subscribers

func (*TxQueue) Enqueue

func (q *TxQueue) Enqueue(tx *common.QueuedTx) error

Enqueue enqueues incoming transaction

func (*TxQueue) Get

func (q *TxQueue) Get(id common.QueuedTxID) (*common.QueuedTx, error)

Get returns transaction by transaction identifier

func (*TxQueue) Has

func (q *TxQueue) Has(id common.QueuedTxID) bool

Has checks whether transaction with a given identifier exists in queue

func (*TxQueue) LockInprogress

func (q *TxQueue) LockInprogress(id common.QueuedTxID) error

LockInprogress returns error if transaction is already inprogress.

func (*TxQueue) Remove

func (q *TxQueue) Remove(id common.QueuedTxID)

Remove removes transaction by transaction identifier

func (*TxQueue) Reset

func (q *TxQueue) Reset()

Reset is to be used in tests only, as it simply creates new transaction map, w/o any cleanup of the previous one

func (*TxQueue) Start

func (q *TxQueue) Start()

Start starts enqueue and eviction loops

func (*TxQueue) Stop

func (q *TxQueue) Stop()

Stop stops transaction enqueue and eviction loops

Jump to

Keyboard shortcuts

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