db

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package db contains the database interface for the rfq relayer.

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 Datstores

type Datstores interface {
	DatastoreForSigner(address common.Address) (datastore.Batching, error)
	GlobalDatastore() (datastore.Batching, error)
}

Datstores contain the datastores for the p2p comms.

type Reader

type Reader interface {
	PutLatestBlock(ctx context.Context, chainID, height uint64) error
	GetQuoteResultsByStatus(ctx context.Context, matchStatuses ...SynapseRequestStatus) (res []SignRequest, _ error)
}

Reader is the interface for reading from the database.

type Service

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

Service is the interface for the database service.

type SignRequest

type SignRequest struct {
	// TXHash is the hash of the transaction that emitted the event
	TXHash common.Hash
	// OriginChainID is the chain id the transaction hash was sent on
	OriginChainID *big.Int
	// DestChainID is the chain id the transaction hash will be sent on
	DestChainID *big.Int
	// Status is the status of the transaction
	Status SynapseRequestStatus
	// SignedEntryHash is the hash of the signed entry
	SignedEntryHash common.Hash
	// Entry is the raw entry.
	Entry []byte
}

SignRequest is the request to sign a transaction.

type SynapseRequestStatus

type SynapseRequestStatus uint8

SynapseRequestStatus is the status of a synapse request.

const (
	// Seen is the status of a synapse request that has been seen.
	Seen SynapseRequestStatus = iota + 1
	// Signed is the status of a synapse request that has been signed.
	Signed
	// Broadcast is the status of a synapse request that has been broadcast.
	Broadcast
	// Completed is the status of a synapse request that has been completed.
	Completed // Completed is the status of a synapse request that has been completed.
)

func (SynapseRequestStatus) GormDataType

func (s SynapseRequestStatus) GormDataType() string

GormDataType implements the gorm common interface for enums.

func (SynapseRequestStatus) Int

func (s SynapseRequestStatus) Int() uint8

Int returns the integer value of the synapse request status.

func (*SynapseRequestStatus) Scan

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

Scan implements the gorm common interface for enums.

func (SynapseRequestStatus) String

func (i SynapseRequestStatus) String() string

func (SynapseRequestStatus) Value

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

Value implements the gorm common interface for enums.

type Writer

type Writer interface {
	LatestBlockForChain(ctx context.Context, chainID uint64) (uint64, error)
	UpdateSignRequestStatus(ctx context.Context, txid common.Hash, status SynapseRequestStatus) error
	StoreInterchainTransactionReceived(ctx context.Context, originChainID int, sr synapsemodule.SynapseModuleBatchVerificationRequested) error
}

Writer is the interface for writing to the database.

Directories

Path Synopsis
Package base contains the base implementation for different sql driers.
Package base contains the base implementation for different sql driers.
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
util
Package util is used to avoid circular dependencies between packages.
Package util is used to avoid circular dependencies between packages.
Package sqlite provides the sqlite implementation for the base store.
Package sqlite provides the sqlite implementation for the base store.

Jump to

Keyboard shortcuts

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