actpool

package
v0.5.0-rc4-hotfix2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 17 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClock added in v0.4.4

func WithClock(c clock.Clock) interface{ ActQueueOption }

WithClock returns an option to overwrite clock.

func WithTimeOut added in v0.4.4

func WithTimeOut(ttl time.Duration) interface{ ActQueueOption }

WithTimeOut returns an option to overwrite time out setting.

Types

type ActPool

type ActPool interface {
	// Reset resets actpool state
	Reset()
	// PendingActionMap returns an action map with all accepted actions
	PendingActionMap() map[string][]action.SealedEnvelope
	// Add adds an action into the pool after passing validation
	Add(act action.SealedEnvelope) error
	// GetPendingNonce returns pending nonce in pool given an account address
	GetPendingNonce(addr string) (uint64, error)
	// GetUnconfirmedActs returns unconfirmed actions in pool given an account address
	GetUnconfirmedActs(addr string) []action.SealedEnvelope
	// GetActionByHash returns the pending action in pool given action's hash
	GetActionByHash(hash hash.Hash256) (action.SealedEnvelope, error)
	// GetSize returns the act pool size
	GetSize() uint64
	// GetCapacity returns the act pool capacity
	GetCapacity() uint64
	// AddActionValidators add validators
	AddActionValidators(...protocol.ActionValidator)

	AddActionEnvelopeValidators(...protocol.ActionEnvelopeValidator)
}

ActPool is the interface of actpool

func NewActPool

func NewActPool(bc blockchain.Blockchain, cfg config.ActPool) (ActPool, error)

NewActPool constructs a new actpool

type ActQueue

type ActQueue interface {
	Overlaps(action.SealedEnvelope) bool
	Put(action.SealedEnvelope) error
	FilterNonce(uint64) []action.SealedEnvelope
	UpdateQueue(uint64) []action.SealedEnvelope
	SetPendingNonce(uint64)
	PendingNonce() uint64
	SetPendingBalance(*big.Int)
	PendingBalance() *big.Int
	Len() int
	Empty() bool
	PendingActs() []action.SealedEnvelope
	AllActs() []action.SealedEnvelope
}

ActQueue is the interface of actQueue

func NewActQueue

func NewActQueue(ap *actPool, address string, ops ...ActQueueOption) ActQueue

NewActQueue create a new action queue

type ActQueueOption added in v0.4.4

type ActQueueOption interface {
	SetActQueueOption(*actQueue)
}

ActQueueOption is the option for actQueue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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