signercache

package
v1.112.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheManager

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

CacheManager maintain a store of the transaction that signer already signed

func NewSignerCacheManager

func NewSignerCacheManager(db *leveldb.DB) (*CacheManager, error)

NewSignerCacheManager create a new instance of CacheManager

func (*CacheManager) GetLatestRecordedTx

func (cm *CacheManager) GetLatestRecordedTx(vaultKey string) (string, error)

func (*CacheManager) HasSigned

func (cm *CacheManager) HasSigned(txOutItemHash string) bool

HasSigned check whether the given tx out item has been signed before

func (*CacheManager) RemoveSigned

func (cm *CacheManager) RemoveSigned(transactionHash string)

RemoveSigned remove the given transaction hash related tx out item cache Usually this means the given transaction failed, so need to remove it from cache , so it can retry

func (*CacheManager) SetSigned

func (cm *CacheManager) SetSigned(txOutItemHash, vaultKey, transactionHash string) error

SetSigned mark a tx out item has been signed

type CacheStore

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

CacheStore manage the key value store used to store what tx out items have been signed before

func NewCacheStore

func NewCacheStore(db *leveldb.DB) *CacheStore

NewCacheStore create a new instance of CacheStore

func (*CacheStore) Close

func (s *CacheStore) Close() error

Close underlying db

func (*CacheStore) GetLatestRecordedTx

func (s *CacheStore) GetLatestRecordedTx(vaultKey string) (string, error)

func (*CacheStore) HasSigned

func (s *CacheStore) HasSigned(hash string) bool

HasSigned check whether the given height and hash has been signed before or not

func (*CacheStore) RemoveSigned

func (s *CacheStore) RemoveSigned(transactionHash string) error

RemoveSigned delete a hash from the signed cache

func (*CacheStore) SetLatestRecordedTx

func (s *CacheStore) SetLatestRecordedTx(vaultKey, transactionHash string) error

SetLatestRecordedTx map a vault and transaction inbound or outbound to transaction hash

func (*CacheStore) SetSigned

func (s *CacheStore) SetSigned(hash string) error

SetSigned update key value store to set the given height and hash as signed

func (*CacheStore) SetTransactionHashMap

func (s *CacheStore) SetTransactionHashMap(txOutItemHash, transactionHash string) error

SetTransactionHashMap map a transaction hash to a tx out item hash

type StorageAccessor

type StorageAccessor interface {
	SetSigned(hash string) error
	HasSigned(hash string) bool
	RemoveSigned(transactionHash string) error
	SetTransactionHashMap(txOutItemHash, transactionHash string) error
	SetLatestRecordedTx(vaultKey, transactionHash string) error
	GetLatestRecordedTx(vaultKey string) (string, error)
}

StorageAccessor define the necessary methods to access the key value store

Jump to

Keyboard shortcuts

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