actpool

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TransferSizeLimit is the maximum size of transfer allowed
	TransferSizeLimit = 32 * 1024
	// VoteSizeLimit is the maximum size of vote allowed
	VoteSizeLimit = 236
	// GlobalSlots indicate maximum number of actions the whole actpool can hold
	GlobalSlots = 8192
	// AccountSlots indicate maximum number of an account queue can hold
	AccountSlots = 256
)

Variables

View Source
var (
	// ErrInvalidAddr is the error that the address format is invalid, cannot be decoded
	ErrInvalidAddr = errors.New("address format is invalid")
	// ErrActPool indicates the error of actpool
	ErrActPool = errors.New("invalid actpool")
	// ErrTransfer indicates the error of transfer
	ErrTransfer = errors.New("invalid transfer")
	// ErrNonce indicates the error of nonce
	ErrNonce = errors.New("invalid nonce")
	// ErrBalance indicates the error of balance
	ErrBalance = errors.New("invalid balance")
)

Functions

This section is empty.

Types

type ActPool

type ActPool interface {
	// Reset resets actpool state
	Reset()
	// PickActs returns all currently accepted transfers and votes in actpool
	PickActs() ([]*action.Transfer, []*action.Vote)
	// AddTsf adds an transfer into the pool after passing validation
	AddTsf(tsf *action.Transfer) error
	// AddVote adds a vote into the pool after passing validation
	AddVote(vote *action.Vote) error
}

ActPool is the interface of actpool

func NewActPool

func NewActPool(sf state.Factory) ActPool

NewActPool constructs a new actpool

type ActQueue

type ActQueue interface {
	Overlaps(*iproto.ActionPb) bool
	Put(*iproto.ActionPb) error
	FilterNonce(uint64) []*iproto.ActionPb
	UpdateNonce(uint64)
	SetConfirmedNonce(uint64)
	ConfirmedNonce() uint64
	SetPendingNonce(uint64)
	PendingNonce() uint64
	SetPendingBalance(*big.Int)
	PendingBalance() *big.Int
	Len() int
	Empty() bool
	ConfirmedActs() []*iproto.ActionPb
}

ActQueue is the interface of actQueue

func NewActQueue

func NewActQueue() ActQueue

NewActQueue create a new action queue

Jump to

Keyboard shortcuts

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