Documentation ¶
Overview ¶
Package base contains the base sql implementation
Index ¶
- Variables
- func GetAllModels() (allModels []interface{})
- func MessageToDBMessage(message Message) types.DBMessage
- type Message
- type Store
- func (s Store) DB() *gorm.DB
- func (s Store) GetLastBlockNumber(ctx context.Context, chainID uint32) (uint64, error)
- func (s Store) GetMessage(ctx context.Context, messageMask types.DBMessage) (*agentsTypes.Message, error)
- func (s Store) GetMessages(ctx context.Context, messageMask types.DBMessage, page int) ([]agentsTypes.Message, error)
- func (s Store) GetRoot(ctx context.Context, messageMask types.DBMessage) (common.Hash, error)
- func (s Store) StoreMessage(ctx context.Context, message agentsTypes.Message, root common.Hash, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ChainIDFieldName gets the chain id field name. ChainIDFieldName string // DestinationFieldName is the field name of the destination. DestinationFieldName string // NonceFieldName is the field name of the tx hash. NonceFieldName string // RootFieldName is the name of the block number field. RootFieldName string // BlockNumberFieldName is the index field name. BlockNumberFieldName string )
var PageSize = 50_000
PageSize is the amount of entries per page of logs.
Functions ¶
func GetAllModels ¶
func GetAllModels() (allModels []interface{})
GetAllModels gets all models to migrate see: https://medium.com/@SaifAbid/slice-interfaces-8c78f8b6345d for an explanation of why we can't do this at initialization time
func MessageToDBMessage ¶
MessageToDBMessage converts a Message to a DBMessage.
Types ¶
type Message ¶
type Message struct { // ChainID is the chain id. ChainID uint32 `gorm:"column:chain_id;primaryKey"` // Destination is the destination. Destination uint32 `gorm:"column:destination;primaryKey"` // Nonce is the nonce. Nonce uint32 `gorm:"column:nonce;primaryKey"` // Root is the root. Root string `gorm:"column:root;primaryKey"` // Message is the message. Message []byte `gorm:"column:message"` // BlockNumber is the block number. BlockNumber uint64 `gorm:"column:block_number"` }
Message is the information about a message parsed by the Executor.
func AgentsTypesMessageToMessage ¶
func AgentsTypesMessageToMessage(message agentsTypes.Message, root common.Hash, blockNumber uint64) (Message, error)
AgentsTypesMessageToMessage converts an agentsTypes.Message to a Message.
func DBMessageToMessage ¶
DBMessageToMessage converts a DBMessage to a Message.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the sqlite store. It extends the base store for sqlite specific queries.
func (Store) GetLastBlockNumber ¶
GetLastBlockNumber gets the last block number that had a message in the database.
func (Store) GetMessage ¶
func (s Store) GetMessage(ctx context.Context, messageMask types.DBMessage) (*agentsTypes.Message, error)
GetMessage gets a message from the database.
func (Store) GetMessages ¶
func (s Store) GetMessages(ctx context.Context, messageMask types.DBMessage, page int) ([]agentsTypes.Message, error)
GetMessages gets messages from the database, paginated and ordered in ascending order by nonce.