txpool

package
v1.2.19 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(checks []TxnCheckFn, stxn *SignedTxn) error

Types

type ItxPool

type ItxPool interface {
	// Capacity return pool capacity of txpool
	Capacity() int
	// Size return pool size of txpool
	Size() int

	WithBaseCheck(checkFn TxnChecker) ItxPool
	WithTripodCheck(tripodName string, checker TxnChecker) ItxPool

	SetPackFilter(fn func(txn *SignedTxn) bool)

	BaseCheck(*SignedTxn) error
	TripodsCheck(stxn *SignedTxn) error

	// NecessaryCheck uses for SyncTxns
	NecessaryCheck(stxn *SignedTxn) error

	Exist(txnHash Hash) bool
	CheckTxn(stxn *SignedTxn) error

	Insert(txn *SignedTxn) error
	SetOrder(order map[int]Hash)
	SortTxns(fn func(txns []*SignedTxn) []*SignedTxn)

	// Pack packs some txns to send to tripods
	Pack(numLimit uint64) ([]*SignedTxn, error)

	PackFor(numLimit uint64, filter func(txn *SignedTxn) bool) ([]*SignedTxn, error)

	// GetTxn returns unpacked txn
	GetTxn(hash Hash) (*SignedTxn, error)
	GetAllTxns() ([]*SignedTxn, error)
	// Reset Deletes packed txns
	Reset(txns SignedTxns) error
	ResetByHashes(hashes []Hash) error
}

type IunpackedTxns

type IunpackedTxns interface {
	Insert(input *SignedTxn) error
	Deletes(txnHashes []Hash)
	Exist(txnHash Hash) bool
	Get(txnHash Hash) *SignedTxn
	GetAll() []*SignedTxn
	Gets(numLimit uint64, filter func(txn *SignedTxn) bool) []*SignedTxn
	SortTxns(fn func(txns []*SignedTxn) []*SignedTxn)
	SetOrder(order map[int]Hash)
	Size() int
}

type TxPool

type TxPool struct {
	TxnMaxSize int
	// contains filtered or unexported fields
}

func NewTxPool

func NewTxPool(nodeType int, cfg *TxpoolConf) *TxPool

func WithDefaultChecks

func WithDefaultChecks(nodeType int, cfg *TxpoolConf) *TxPool

func (*TxPool) BaseCheck

func (tp *TxPool) BaseCheck(stxn *SignedTxn) error

func (*TxPool) Capacity added in v1.0.10

func (tp *TxPool) Capacity() int

func (*TxPool) CheckTxn

func (tp *TxPool) CheckTxn(stxn *SignedTxn) (err error)

func (*TxPool) Exist

func (tp *TxPool) Exist(txnHash Hash) bool

func (*TxPool) GetAllTxns

func (tp *TxPool) GetAllTxns() ([]*SignedTxn, error)

func (*TxPool) GetTxn

func (tp *TxPool) GetTxn(hash Hash) (*SignedTxn, error)

func (*TxPool) Insert

func (tp *TxPool) Insert(stxn *SignedTxn) error

func (*TxPool) NecessaryCheck

func (tp *TxPool) NecessaryCheck(stxn *SignedTxn) (err error)

func (*TxPool) Pack

func (tp *TxPool) Pack(numLimit uint64) ([]*SignedTxn, error)

func (*TxPool) PackFor

func (tp *TxPool) PackFor(numLimit uint64, filter func(txn *SignedTxn) bool) ([]*SignedTxn, error)

func (*TxPool) Reset

func (tp *TxPool) Reset(txns SignedTxns) error

func (*TxPool) ResetByHashes

func (tp *TxPool) ResetByHashes(hashes []Hash) error

func (*TxPool) SetOrder

func (tp *TxPool) SetOrder(order map[int]Hash)

func (*TxPool) SetPackFilter added in v1.2.8

func (tp *TxPool) SetPackFilter(fn func(txn *SignedTxn) bool)

func (*TxPool) Size added in v1.0.10

func (tp *TxPool) Size() int

func (*TxPool) SortTxns

func (tp *TxPool) SortTxns(fn func(txns []*SignedTxn) []*SignedTxn)

func (*TxPool) TripodsCheck

func (tp *TxPool) TripodsCheck(stxn *SignedTxn) error

func (*TxPool) WithBaseCheck

func (tp *TxPool) WithBaseCheck(tc TxnChecker) ItxPool

func (*TxPool) WithTripodCheck

func (tp *TxPool) WithTripodCheck(tripodName string, tc TxnChecker) ItxPool

type TxnCheckFn

type TxnCheckFn func(*SignedTxn) error

Jump to

Keyboard shortcuts

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