localcache

package
v0.0.0-...-864a747 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpected              = errors.New("unexpected error")
	ErrNotAllowReoccurringHash = errors.New("not allowed reoccurring hash")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxLen int `yaml:"max_len"`
}

type TransactionCache

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

TransactionCache is designed to store data in parallel with repository.

func NewTransactionCache

func NewTransactionCache(cfg Config) *TransactionCache

NewTransactionCache creates a new TransactionCache according to Config.

func (*TransactionCache) CleanSignedTransactions

func (c *TransactionCache) CleanSignedTransactions(trxs []transaction.Transaction)

CleanSignedTransactions removes all the transactions with given hashes from the cache.

func (*TransactionCache) ReadAwaitingTransactionsByIssuer

func (c *TransactionCache) ReadAwaitingTransactionsByIssuer(address string) ([]transaction.Transaction, error)

ReadAwaitingTransactionsByIssuer reads transaction belonging to the issuer if exists in the cache.

func (*TransactionCache) ReadAwaitingTransactionsByReceiver

func (c *TransactionCache) ReadAwaitingTransactionsByReceiver(address string) ([]transaction.Transaction, error)

ReadAwaitingTransactionsByReceiver reads transaction belongint to the receiver if exists in the cache.

func (*TransactionCache) WriteIssuerSignedTransactionForReceiver

func (c *TransactionCache) WriteIssuerSignedTransactionForReceiver(trx *transaction.Transaction) error

WriteIssuerSignedTransactionForReceiver writes transaction to cache if cache has enough space.

Jump to

Keyboard shortcuts

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