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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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