db

package
v0.0.152 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package db implements the data store

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNonceForChain = errors.New("no nonce exists for this chain")

ErrNoNonceForChain indicates that no nonces have been saved for the chain yet.

View Source
var ErrNoNonceForDomain = errors.New("no nonce exists for this domain")

ErrNoNonceForDomain indicates there is no nonce for a domain.

View Source
var ErrNoStoredBlockForChain = errors.New("no block exists for this chain")

ErrNoStoredBlockForChain indicates there are no blocks stored for this domain.

View Source
var ErrNotFound = errors.New("record not found")

ErrNotFound is a not found record standardized across db drivers.

Functions

This section is empty.

Types

type InProgressAttestationDB added in v0.0.58

type InProgressAttestationDB interface {
	// RetrieveLatestCachedNonce gets the latest nonce cached for a particular origin-destination pair
	// returns ErrNoNonceForDomain if no nonce exists.
	RetrieveLatestCachedNonce(ctx context.Context, originID, destinationID uint32) (nonce uint32, err error)
	// StoreNewInProgressAttestation stores a in-progress attestation only if it hasn't already been stored
	StoreNewInProgressAttestation(ctx context.Context, attestation types.Attestation) error
	// StoreNewGuardInProgressAttestation stores a in-progress attestation only if it hasn't already been stored
	StoreNewGuardInProgressAttestation(ctx context.Context, attestation types.Attestation) error
}

InProgressAttestationDB stores in-progress attesations. nolint

type MessageDB

type MessageDB interface {
	// RetrieveLatestCommittedMessageNonce gets the latest nonce of a committed message
	// returns ErrNoNonceForDomain if no nonce exists
	RetrieveLatestCommittedMessageNonce(ctx context.Context, domainID uint32) (nonce uint32, err error)
	// StoreMessageLatestBlockEnd stores the latest block end
	StoreMessageLatestBlockEnd(ctx context.Context, domainID uint32, blockNumber uint32) error
	// GetMessageLatestBlockEnd gets the message latest block
	// returns ErrNoStoredBlockForChain when not present
	GetMessageLatestBlockEnd(ctx context.Context, domainID uint32) (height uint32, err error)
	// StoreCommittedMessage stores a raw committed message
	StoreCommittedMessage(ctx context.Context, domainID uint32, message types.CommittedMessage) error
}

MessageDB stores messages. nolint TODO (joe): This needs to be refactored after we do the GlobalRegistry stuff

type MonitorDB

type MonitorDB interface {
	// StoreDispatchMessage stores a dispatch message
	StoreDispatchMessage(ctx context.Context, message types.Message) error
	// StoreAcceptedAttestation stores an accepted attestation
	StoreAcceptedAttestation(ctx context.Context, attestation types.Attestation) error
	// GetDelinquentMessage gets messages that were sent, but never received
	GetDelinquentMessages(ctx context.Context, destinationDomain uint32) ([]types.Message, error)
}

MonitorDB stores event data for monitoring.

type SynapseDB

type SynapseDB interface {
	MessageDB
	TxQueueDB
	MonitorDB
	InProgressAttestationDB
}

SynapseDB combines db types.

type TxQueueDB

type TxQueueDB interface {
	// StoreRawTx stores a raw transaction
	StoreRawTx(ctx context.Context, tx *ethTypes.Transaction, chainID *big.Int, from common.Address) error
	// StoreProcessedTx stores a tx that has already been processed
	StoreProcessedTx(ctx context.Context, tx *ethTypes.Transaction) error
	// GetNonceForChainID gets the latest nonce for a sender
	GetNonceForChainID(ctx context.Context, fromAddress common.Address, chainID *big.Int) (nonce uint64, err error)
}

TxQueueDB contains an interface for storing transactions currently being processed.

Directories

Path Synopsis
datastore
sql
Package sql accesses a db
Package sql accesses a db
sql/base
Package base contains the base sql implementation
Package base contains the base sql implementation
sql/mysql
Package mysql implements the mysql package
Package mysql implements the mysql package
sql/sqlite
Package sqlite implements the sqlite package
Package sqlite implements the sqlite package

Jump to

Keyboard shortcuts

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