storage

package
v0.0.0-...-5d7b32d Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStore

type PostgresStore struct {
	DB      *bun.DB
	ChainID int64
	// contains filtered or unexported fields
}

func NewPostgresDB

func NewPostgresDB(conf config.PostgresConfig) *PostgresStore

func (*PostgresStore) BulkInsertBlockTimestamp

func (p *PostgresStore) BulkInsertBlockTimestamp(blockTimestamps []*types.BlockTimestamp) error

func (*PostgresStore) BulkInsertPairInfo

func (p *PostgresStore) BulkInsertPairInfo(pairInfos []*types.Pair) error

func (*PostgresStore) BulkInsertTokenInfo

func (p *PostgresStore) BulkInsertTokenInfo(tokenInfos []*types.Token) error

func (*PostgresStore) CreateIndexes

func (p *PostgresStore) CreateIndexes()

func (*PostgresStore) CreateTables

func (p *PostgresStore) CreateTables() error

func (*PostgresStore) FindPairs

func (p *PostgresStore) FindPairs(req *types.FindPairsRequest) ([]*types.Pair, error)

func (*PostgresStore) FindTokens

func (p *PostgresStore) FindTokens(req *types.FindTokensRequest) ([]*types.Token, error)

func (*PostgresStore) GetBlockAtTimestamp

func (p *PostgresStore) GetBlockAtTimestamp(timestamp int64) (*types.BlockTimestamp, error)

func (*PostgresStore) GetBlockTimestamps

func (p *PostgresStore) GetBlockTimestamps(to int64, from int64) ([]*types.BlockTimestamp, error)

func (*PostgresStore) GetChainID

func (p *PostgresStore) GetChainID() int64

func (*PostgresStore) GetHeights

func (p *PostgresStore) GetHeights() (*types.Heights, error)

func (*PostgresStore) GetHight

func (p *PostgresStore) GetHight() (int64, error)

func (*PostgresStore) GetPairCount

func (p *PostgresStore) GetPairCount() (int64, error)

func (*PostgresStore) GetPairsWithoutTokenInfo

func (p *PostgresStore) GetPairsWithoutTokenInfo() ([]string, error)

func (*PostgresStore) GetTokenCount

func (p *PostgresStore) GetTokenCount() (int64, error)

func (*PostgresStore) GetUniqueAddressesFromPairs

func (p *PostgresStore) GetUniqueAddressesFromPairs() ([]string, error)

func (*PostgresStore) GetUniqueAddressesFromTokens

func (p *PostgresStore) GetUniqueAddressesFromTokens() ([]string, error)

func (*PostgresStore) Init

func (p *PostgresStore) Init() error

func (*PostgresStore) InsertBlockTimestamp

func (p *PostgresStore) InsertBlockTimestamp(blockTimestamp *types.BlockTimestamp) error

func (*PostgresStore) InsertPairInfo

func (p *PostgresStore) InsertPairInfo(pairInfo *types.Pair) error

func (*PostgresStore) InsertTokenInfo

func (p *PostgresStore) InsertTokenInfo(tokenInfo *types.Token) error

func (*PostgresStore) Ready

func (p *PostgresStore) Ready() bool

func (*PostgresStore) WithChainID

func (p *PostgresStore) WithChainID(chainID int64) *PostgresStore

func (*PostgresStore) WithDebug

func (p *PostgresStore) WithDebug() *PostgresStore

type Store

type Store interface {
	Init() error
	Ready() bool
	GetChainID() int64
	GetHight() (int64, error)

	// block timestamp
	GetBlockAtTimestamp(int64) (*types.BlockTimestamp, error)
	InsertBlockTimestamp(*types.BlockTimestamp) error
	BulkInsertBlockTimestamp([]*types.BlockTimestamp) error
	GetBlockTimestamps(to int64, from int64) ([]*types.BlockTimestamp, error)

	// token info
	FindTokens(*types.FindTokensRequest) ([]*types.Token, error)
	GetTokenCount() (int64, error)
	InsertTokenInfo(*types.Token) error
	BulkInsertTokenInfo([]*types.Token) error

	// pair info
	FindPairs(*types.FindPairsRequest) ([]*types.Pair, error)
	GetPairCount() (int64, error)
	InsertPairInfo(*types.Pair) error
	BulkInsertPairInfo([]*types.Pair) error

	// util
	GetUniqueAddressesFromPairs() ([]string, error)
	GetUniqueAddressesFromTokens() ([]string, error)
	GetPairsWithoutTokenInfo() ([]string, error)
	GetHeights() (*types.Heights, error)
}

type StoreMap

type StoreMap struct {
	// contains filtered or unexported fields
}

func NewStoreMap

func NewStoreMap() *StoreMap

func (*StoreMap) GetAll

func (s *StoreMap) GetAll() []Store

func (*StoreMap) GetStore

func (s *StoreMap) GetStore(chainID int64) Store

get store or return nil

func (*StoreMap) SetStore

func (s *StoreMap) SetStore(chainID int64, store Store) bool

Jump to

Keyboard shortcuts

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