Documentation ¶
Index ¶
- Constants
- type LevelDBStorage
- func (s *LevelDBStorage) Close() error
- func (s *LevelDBStorage) GetAllPendingTxs() ([]*relay.PendingSubmittedTxInfo, error)
- func (s *LevelDBStorage) GetAllUnsuccessfulTxs() ([]*relay.UnsuccessfulTxInfo, error)
- func (s *LevelDBStorage) GetCachedTx(queryID uint64, hash string) (*relay.Transaction, error)
- func (s *LevelDBStorage) GetLastQueryHeight(queryID uint64) (block uint64, found bool, err error)
- func (s *LevelDBStorage) SetLastQueryHeight(queryID uint64, block uint64) error
- func (s *LevelDBStorage) SetTxStatus(queryID uint64, hash string, neutronHash string, txInfo relay.SubmittedTxInfo, ...) (err error)
- func (s *LevelDBStorage) TxExists(queryID uint64, hash string) (exists bool, err error)
Constants ¶
View Source
const ( SubmittedTxStatusPrefix = "submitted_txs" UnsuccessfulTxStatusPrefix = "unsuccessful_txs" CachedTxs = "cached_txs" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LevelDBStorage ¶
type LevelDBStorage struct {
// contains filtered or unexported fields
}
LevelDBStorage Basically has a simple structure inside: we have 2 maps first one : map of queryID -> last block this query has been processed second one: map of queryID+txHash -> status of sent tx
func NewLevelDBStorage ¶
func NewLevelDBStorage(path string) (*LevelDBStorage, error)
func (*LevelDBStorage) Close ¶
func (s *LevelDBStorage) Close() error
func (*LevelDBStorage) GetAllPendingTxs ¶
func (s *LevelDBStorage) GetAllPendingTxs() ([]*relay.PendingSubmittedTxInfo, error)
func (*LevelDBStorage) GetAllUnsuccessfulTxs ¶ added in v0.2.0
func (s *LevelDBStorage) GetAllUnsuccessfulTxs() ([]*relay.UnsuccessfulTxInfo, error)
func (*LevelDBStorage) GetCachedTx ¶ added in v0.2.0
func (s *LevelDBStorage) GetCachedTx(queryID uint64, hash string) (*relay.Transaction, error)
GetCachedTx returns a cached remote tx
func (*LevelDBStorage) GetLastQueryHeight ¶
func (s *LevelDBStorage) GetLastQueryHeight(queryID uint64) (block uint64, found bool, err error)
GetLastQueryHeight returns last update block for KV query
func (*LevelDBStorage) SetLastQueryHeight ¶
func (s *LevelDBStorage) SetLastQueryHeight(queryID uint64, block uint64) error
SetLastQueryHeight sets last processed block to given query
func (*LevelDBStorage) SetTxStatus ¶
func (s *LevelDBStorage) SetTxStatus(queryID uint64, hash string, neutronHash string, txInfo relay.SubmittedTxInfo, processedTx *relay.Transaction) (err error)
SetTxStatus sets status for given tx queryID + hash can be one of 4 statuses:
- Error while submitting tx - relay.ErrorOnSubmit
- tx submitted successfully (temporary status, should be updated after neutron tx committed into the block) - relay.Submitted 2.a) failed to commit tx into the block - relay.ErrorOnCommit 2.b) tx successfully committed - relay.Committed
To convert status from "2" to either "2.a" or "2.b" we use additional SubmittedTxStatusPrefix storage to track txs
Click to show internal directories.
Click to hide internal directories.