db

package
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package db provides a database interface for the executor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutorDB

type ExecutorDB interface {
	ExecutorDBWriter
	ExecutorDBReader
}

ExecutorDB is the interface for the executor database.

type ExecutorDBReader

type ExecutorDBReader interface {
	// GetMessage gets a message from the database.
	GetMessage(ctx context.Context, messageMask types.DBMessage) (*agentsTypes.Message, error)
	// GetMessages gets messages from the database, paginated and ordered in ascending order by nonce.
	GetMessages(ctx context.Context, messageMask types.DBMessage, page int) ([]agentsTypes.Message, error)
	// GetBlockNumber gets the block number of a message from the database.
	GetBlockNumber(ctx context.Context, messageMask types.DBMessage) (uint64, error)
	// GetLastBlockNumber gets the last block number that had a message in the database.
	GetLastBlockNumber(ctx context.Context, chainID uint32) (uint64, error)

	// GetAttestation gets an attestation from the database.
	GetAttestation(ctx context.Context, attestationMask types.DBAttestation) (*agentsTypes.Attestation, error)
	// GetAttestationBlockNumber gets the block number of an attestation.
	GetAttestationBlockNumber(ctx context.Context, attestationMask types.DBAttestation) (*uint64, error)
	// GetAttestationBlockTime gets the block time of an attestation.
	GetAttestationBlockTime(ctx context.Context, attestationMask types.DBAttestation) (*uint64, error)
}

ExecutorDBReader is the interface for reading from the executor database.

type ExecutorDBWriter

type ExecutorDBWriter interface {
	// StoreMessage stores a message in the database.
	StoreMessage(ctx context.Context, message agentsTypes.Message, blockNumber uint64) error

	// StoreAttestation stores an attestation.
	StoreAttestation(ctx context.Context, attestation agentsTypes.Attestation, blockNumber uint64, blockTime uint64) error
}

ExecutorDBWriter is the interface for writing to the executor database.

Directories

Path Synopsis
datastore
sql
Package sql provides a datastore implementation for the executor.
Package sql provides a datastore implementation for the executor.
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