txstore

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ITxStore

type ITxStore interface {
	ListTransactions() (txs []*TimestampedTransaction, err error)
	GetFirstTransaction() (tx *TimestampedTransaction, err error)
	SaveTransaction(tx *types.Transaction) (err error)
	UpdateTransactionByNonce(tx *types.Transaction) (err error)
	RemoveTransactionsLessThanNonce(nonce uint64) (err error)
	Clear() (err error)
	Close() (err error)
}

type LevelDbTxStore

type LevelDbTxStore struct {
	*leveldb.DB
	// contains filtered or unexported fields
}

func NewLevelDbTxStore

func NewLevelDbTxStore(file string, clk clock.Clock) (store *LevelDbTxStore, err error)

func (*LevelDbTxStore) Clear

func (store *LevelDbTxStore) Clear() (err error)

Clear removes all transactions stored

func (*LevelDbTxStore) GetFirstTransaction

func (store *LevelDbTxStore) GetFirstTransaction() (tx *TimestampedTransaction, err error)

GetFirstTransaction returns transaction with lowest nonce

func (*LevelDbTxStore) ListTransactions

func (store *LevelDbTxStore) ListTransactions() (txs []*TimestampedTransaction, err error)

ListTransactions returns all transactions on the store, useful for testing

func (*LevelDbTxStore) RemoveTransactionsLessThanNonce

func (store *LevelDbTxStore) RemoveTransactionsLessThanNonce(nonce uint64) (err error)

RemoveTransactionsLessThanNonce removes all transactions with nonce values up to the specified value inclusive

func (*LevelDbTxStore) SaveTransaction

func (store *LevelDbTxStore) SaveTransaction(tx *types.Transaction) (err error)

SaveTransaction dates and stores transaction sorted by ascending nonce

func (*LevelDbTxStore) UpdateTransactionByNonce

func (store *LevelDbTxStore) UpdateTransactionByNonce(tx *types.Transaction) (err error)

UpdateTransactionByNonce updates a transaction given its nonce, returns error if tx with same nonce does not exist

type MemoryTxStore

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

func NewMemoryTxStore

func NewMemoryTxStore(clk clock.Clock) *MemoryTxStore

func (*MemoryTxStore) Clear

func (store *MemoryTxStore) Clear() (err error)

Clear removes all transactions stored

func (*MemoryTxStore) Close

func (store *MemoryTxStore) Close() (err error)

func (*MemoryTxStore) GetFirstTransaction

func (store *MemoryTxStore) GetFirstTransaction() (tx *TimestampedTransaction, err error)

GetFirstTransaction returns transaction with lowest nonce

func (*MemoryTxStore) ListTransactions

func (store *MemoryTxStore) ListTransactions() (txs []*TimestampedTransaction, err error)

ListTransactions returns all transactions on the store, useful for testing

func (*MemoryTxStore) RemoveTransactionsLessThanNonce

func (store *MemoryTxStore) RemoveTransactionsLessThanNonce(nonce uint64) (err error)

RemoveTransactionsLessThanNonce removes all transactions with nonce values up to the specified value inclusive

func (*MemoryTxStore) SaveTransaction

func (store *MemoryTxStore) SaveTransaction(tx *types.Transaction) (err error)

SaveTransaction dates and stores transaction sorted by ascending nonce

func (*MemoryTxStore) UpdateTransactionByNonce

func (store *MemoryTxStore) UpdateTransactionByNonce(tx *types.Transaction) (err error)

UpdateTransactionByNonce updates a transaction given its nonce, returns error if tx with same nonce does not exist

type TimestampedTransaction

type TimestampedTransaction struct {
	*types.Transaction
	Timestamp int64
}

func DecodeTimestampedTransaction

func DecodeTimestampedTransaction(bytes []byte) (*TimestampedTransaction, error)

func (*TimestampedTransaction) Encode

func (tx *TimestampedTransaction) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

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