db

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package db contains the database interface for the sin-eexecutor.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoLatestBlockForChainID = errors.New("no latest block for chainId")

ErrNoLatestBlockForChainID is returned when no block exists for the chain.

Functions

This section is empty.

Types

type ExecutableStatus

type ExecutableStatus uint8

ExecutableStatus is the status of a synapse request.

const (
	// Seen is the status of a synapse request that has been seen.
	Seen ExecutableStatus = iota + 1
	// Ready is the status of a synapse request that is ready to be executed.
	Ready
	// Executed is the status of a synapse request that has been executed.
	Executed
)

func (ExecutableStatus) GormDataType

func (s ExecutableStatus) GormDataType() string

GormDataType implements the gorm common interface for enums.

func (ExecutableStatus) Int

func (s ExecutableStatus) Int() uint8

Int returns the integer value of the synapse request status.

func (*ExecutableStatus) Scan

func (s *ExecutableStatus) Scan(src any) error

Scan implements the gorm common interface for enums.

func (ExecutableStatus) String

func (i ExecutableStatus) String() string

func (ExecutableStatus) Value

func (s ExecutableStatus) Value() (driver.Value, error)

Value implements the gorm common interface for enums.

type Reader

type Reader interface {
	LatestBlockForChain(ctx context.Context, chainID uint64) (uint64, error)
	GetInterchainTXsByStatus(ctx context.Context, statuses ...ExecutableStatus) ([]TransactionSent, error)
}

Reader is the interface for reading from the database.

type Service

type Service interface {
	Reader
	Writer
	// SubmitterDB returns the submitter database service.
	SubmitterDB() submitterDB.Service
}

Service is the interface for the database service.

type TransactionSent

type TransactionSent struct {
	TransactionID common.Hash
	// EncodedTX is the encoded transaction.
	EncodedTX []byte
	// SrcChainID is the source chain id.
	SrcChainID *big.Int
	// DstChainID is the destination chain id.
	DstChainID *big.Int
	// Status is the status of the transaction.
	Status ExecutableStatus
	// Options is the options of the transaction.
	Options interchainclient.OptionsV1
}

TransactionSent is the transaction sent model. It tracks the data about current status of the transaction/execution.

type Writer

type Writer interface {
	PutLatestBlock(ctx context.Context, chainID, height uint64) error
	StoreInterchainTransaction(ctx context.Context, originChainID *big.Int, interchainTx *interchainclient.InterchainClientV1InterchainTransactionSent, options *interchainclient.OptionsV1, encodedTX []byte) error
	UpdateInterchainTransactionStatus(ctx context.Context, transactionid [32]byte, statuses ExecutableStatus) error
}

Writer is the interface for writing to the database.

Directories

Path Synopsis
Package base provides the base model for all models.
Package base provides the base model for all models.
Package connect contains the database connection logic for the RFQ relayer.
Package connect contains the database connection logic for the RFQ relayer.
Package mysql provides a common interface for starting sql-lite databases
Package mysql provides a common interface for starting sql-lite databases
Package sqlite provides the sqlite store for the sin-executor.
Package sqlite provides the sqlite store for the sin-executor.

Jump to

Keyboard shortcuts

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