signercache

package
v1.127.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 5 Imported by: 4

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 added in v1.125.0

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 removes the corresponding TxOutItem from the signer cache. The provided transaction hash should be for the broadcast transaction - it is internally mapped to the cache key for the TxOutItem.

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 added in v1.125.0

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 removes the corresponding TxOutItem from the signer cache. The provided transaction hash should be for the broadcast transaction - it is internally mapped to the cache key for the TxOutItem.

func (*CacheStore) SetLatestRecordedTx added in v1.125.0

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