Documentation
¶
Index ¶
- Variables
- type Flashback
- type Hippocampus
- func (h *Hippocampus) Close() error
- func (h *Hippocampus) ReadBalance(a string) (spice.Melange, error)
- func (h *Hippocampus) ReadTransactions(address string) ([]transaction.Transaction, error)
- func (h *Hippocampus) RemoveAwaitedTransaction(hash [32]byte, address string) (transaction.Transaction, error)
- func (h *Hippocampus) RemoveBalance(a string) error
- func (h *Hippocampus) SaveAwaitedTransaction(trx *transaction.Transaction) error
- func (h *Hippocampus) SaveBalance(a string, s spice.Melange) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilTransaction = errors.New("cannot cache a nil transaction") ErrFailedDecodingTrxKeyWrongNumOfParts = errors.New("failed decoding transaction key, wrong number of parts") ErrFailedDecodingAddressKeyWrongNumOfParts = errors.New("failed decoding address key, wrong number of parts") ErrTrxAlreadyExists = errors.New("transaction already exists") ErrTransactionNotFound = errors.New("transaction not found") ErrProcessingFailed = errors.New("processing unexpected failure") )
var ErrWrongHashSizeInFlash = errors.New("wrong error size supplied to flashback has hash")
Functions ¶
This section is empty.
Types ¶
type Flashback ¶
type Flashback struct {
// contains filtered or unexported fields
}
func (*Flashback) Close ¶
Close closes the cache in a safe way allowing all the goroutines to finish their jobs and cleaning the heap.
func (*Flashback) HasAddress ¶
HasAddress checks if flashback received given address request.
func (*Flashback) RemoveAddress ¶
RemoveAddress removes address from the cache.
type Hippocampus ¶
type Hippocampus struct {
// contains filtered or unexported fields
}
Hippocampus is a short lived memory that can transmit memorized entities to other long lived memory.
func New ¶
func New(maxEntrySize, maxCacheSizeMB int) (*Hippocampus, error)
New creates the new Hippocampus on success or returns an error otherwise.
func (*Hippocampus) Close ¶
func (h *Hippocampus) Close() error
Close closes the cache in a safe way allowing all the goroutines to finish their jobs and cleaning the heap.
func (*Hippocampus) ReadBalance ¶
func (h *Hippocampus) ReadBalance(a string) (spice.Melange, error)
ReadBalance reads balance from the mem cache.
func (*Hippocampus) ReadTransactions ¶
func (h *Hippocampus) ReadTransactions(address string) ([]transaction.Transaction, error)
func (*Hippocampus) RemoveAwaitedTransaction ¶
func (h *Hippocampus) RemoveAwaitedTransaction(hash [32]byte, address string) (transaction.Transaction, error)
RemoveAwaitedTransaction removes awaited transaction and the issuer and receiver address reference to the transaction.
func (*Hippocampus) RemoveBalance ¶
func (h *Hippocampus) RemoveBalance(a string) error
RemoveBalance removes balance from the cache.
func (*Hippocampus) SaveAwaitedTransaction ¶
func (h *Hippocampus) SaveAwaitedTransaction(trx *transaction.Transaction) error
SaveAwaitedTrx caches awaited transaction and reference of issuer and receiver address to the transaction hash.
func (*Hippocampus) SaveBalance ¶
func (h *Hippocampus) SaveBalance(a string, s spice.Melange) error
SaveBalance saves balance in to the mem cache.