db

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package db provides the database for the consumer service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerDB

type ConsumerDB interface {
	ConsumerDBWriter
	ConsumerDBReader
}

ConsumerDB is the interface for the ConsumerDB.

type ConsumerDBReader

type ConsumerDBReader interface {
	// GetAllChainIDs gets all chain IDs that have been used in bridge events.
	GetAllChainIDs(ctx context.Context) ([]uint32, error)
	// GetSwapSuccess returns if an event had a successful swap.
	GetSwapSuccess(ctx context.Context, kappa string, chainID uint32) (*bool, error)
	// GetTxHashFromKappa returns the transaction hash for a given kappa.
	GetTxHashFromKappa(ctx context.Context, kappa string) (*string, error)
	// ReadBlockNumberByChainID reads an event from the database by chainID.
	ReadBlockNumberByChainID(ctx context.Context, eventType int8, chainID uint32) (*uint64, error)
	// BridgeEventCount returns the number of bridge events.
	BridgeEventCount(ctx context.Context, query string) (count uint64, err error)
	// GetTokenAddressesByChainID gets all token addresses that have been used in bridge events for a given chain ID.
	GetTokenAddressesByChainID(ctx context.Context, query string) ([]string, error)
	// PartialInfosFromIdentifiers returns events given identifiers.
	PartialInfosFromIdentifiers(ctx context.Context, query string) (partialInfos []*model.PartialInfo, err error)
	// GetKappaFromTxHash returns the kappa for a given transaction hash.
	GetKappaFromTxHash(ctx context.Context, query string) (*string, error)
	// GetTransactionCountForEveryAddress gets the count of transactions (origin) for each address.
	GetTransactionCountForEveryAddress(ctx context.Context, subQuery string) ([]*model.AddressRanking, error)
	// GetBridgeStatistic gets bridge statistics
	GetBridgeStatistic(ctx context.Context, subQuery string) (*string, error)
	// GetHistoricalData gets bridge historical data
	GetHistoricalData(ctx context.Context, subQuery string, typeArg *model.HistoricalResultType, filter string) (*model.HistoricalResult, error)
}

ConsumerDBReader is the interface for reading events from the ConsumerDB. nolint:interfacebloat

type ConsumerDBWriter

type ConsumerDBWriter interface {
	// StoreEvent stores an event.
	StoreEvent(ctx context.Context, bridgeEvent *sql.BridgeEvent, swapEvent *sql.SwapEvent) error
	// UNSAFE_DB gets the underlying gorm db. This is not intended for use in production.
	//
	//nolint:golint
	UNSAFE_DB() *gorm.DB
}

ConsumerDBWriter is the interface for writing to the ConsumerDB.

Directories

Path Synopsis
Package sql contains the sql store.
Package sql contains the sql store.

Jump to

Keyboard shortcuts

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