db

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package db implements the data store

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventDB

type EventDB interface {
	EventDBWriter
	EventDBReader
}

EventDB stores events.

type EventDBReader

type EventDBReader interface {
	// RetrieveOriginSent gets the Origin Sent events with a filter.
	RetrieveOriginSent(ctx context.Context, filter model.OriginSent) ([]model.OriginSent, error)
	// RetrieveExecuted gets the Executed events with a filter.
	RetrieveExecuted(ctx context.Context, filter model.Executed) ([]model.Executed, error)
	// RetrieveMessageStatus gets status of a message.
	RetrieveMessageStatus(ctx context.Context, messageHash string) (graphqlModel.MessageStatus, error)
	// RetrieveLastStoredBlock gets the last block stored in sinner.
	RetrieveLastStoredBlock(ctx context.Context, chainID uint32, address common.Address) (uint64, error)
	// RetrieveMessagesByStatus gets messages by their status (pending/completed).
	RetrieveMessagesByStatus(ctx context.Context, messageStatus graphqlModel.MessageState, page int) ([]*graphqlModel.MessageStatus, error)
}

EventDBReader is an interface for reading events from a database.

type EventDBWriter

type EventDBWriter interface {
	// StoreOriginSent stores an OriginSent event.
	StoreOriginSent(ctx context.Context, originSent *model.OriginSent) error
	// StoreExecuted stores an Executed event.
	StoreExecuted(ctx context.Context, executed *model.Executed) error
	// StoreLastIndexed stores the last indexed for a contract address
	StoreLastIndexed(ctx context.Context, contractAddress common.Address, chainID uint32, blockNumber uint64) error
	// StoreOrUpdateMessageStatus stores/updates the status of a message.
	StoreOrUpdateMessageStatus(ctx context.Context, txHash string, messageID string, messageType types.MessageType) error
}

EventDBWriter is an interface for writing events to a database.

type TestEventDB

type TestEventDB interface {
	EventDB
	// UNSAFE_DB gets the underlying gorm db. This is not intended for use in production.
	//
	//nolint:golint
	UNSAFE_DB() *gorm.DB
}

Directories

Path Synopsis
Package model holds all the models for the database.
Package model holds all the models for the database.
sql
Package sql provides a datastore implementation for the executor.
Package sql provides a datastore implementation for the executor.
base
Package base contains the base sql implementation
Package base contains the base sql implementation
mysql
Package mysql implements the mysql package
Package mysql implements the mysql package
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