signercache

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 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) 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, 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 intance of CacheStore

func (*CacheStore) Close

func (s *CacheStore) Close() error

Close underlying db

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) 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
}

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