repositories

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: AGPL-3.0 Imports: 14 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockExists = errors.New("Won't add block that already exists.")
View Source
var ErrValidHeaderExists = errors.New("valid header already exists")

Functions

This section is empty.

Types

type BlockRepository

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

func NewBlockRepository

func NewBlockRepository(database *postgres.DB) *BlockRepository

func (BlockRepository) CreateOrUpdateBlock

func (blockRepository BlockRepository) CreateOrUpdateBlock(block core.Block) (int64, error)

func (BlockRepository) GetBlock

func (blockRepository BlockRepository) GetBlock(blockNumber int64) (core.Block, error)

func (BlockRepository) LoadTransactions

func (blockRepository BlockRepository) LoadTransactions(transactionRows *sqlx.Rows) []core.TransactionModel

func (BlockRepository) MissingBlockNumbers

func (blockRepository BlockRepository) MissingBlockNumbers(startingBlockNumber int64, highestBlockNumber int64, nodeId string) []int64

func (BlockRepository) SetBlocksStatus

func (blockRepository BlockRepository) SetBlocksStatus(chainHead int64) error

type CheckedHeadersRepository added in v0.0.7

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

func NewCheckedHeadersRepository added in v0.0.7

func NewCheckedHeadersRepository(db *postgres.DB) CheckedHeadersRepository

func (CheckedHeadersRepository) MarkHeaderChecked added in v0.0.7

func (repo CheckedHeadersRepository) MarkHeaderChecked(headerID int64) error

Increment check_count for header

func (CheckedHeadersRepository) MarkHeadersUnchecked added in v0.0.7

func (repo CheckedHeadersRepository) MarkHeadersUnchecked(startingBlockNumber int64) error

Zero out check count for headers with block number >= startingBlockNumber

func (CheckedHeadersRepository) UncheckedHeaders added in v0.0.7

func (repo CheckedHeadersRepository) UncheckedHeaders(startingBlockNumber, endingBlockNumber, checkCount int64) ([]core.Header, error)

Return header if check_count < passed checkCount

type CheckedLogsRepository added in v0.0.7

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

func NewCheckedLogsRepository added in v0.0.7

func NewCheckedLogsRepository(db *postgres.DB) CheckedLogsRepository

func (CheckedLogsRepository) AlreadyWatchingLog added in v0.0.7

func (repository CheckedLogsRepository) AlreadyWatchingLog(addresses []string, topic0 string) (bool, error)

Return whether a given address + topic0 has been fetched on a previous run of vDB

func (CheckedLogsRepository) MarkLogWatched added in v0.0.7

func (repository CheckedLogsRepository) MarkLogWatched(addresses []string, topic0 string) error

Persist that a given address + topic0 has is being fetched on this run of vDB

type ContractRepository

type ContractRepository struct {
	*postgres.DB
}

func (ContractRepository) ContractExists

func (contractRepository ContractRepository) ContractExists(contractHash string) (bool, error)

func (ContractRepository) CreateContract

func (contractRepository ContractRepository) CreateContract(contract core.Contract) error

func (ContractRepository) GetContract

func (contractRepository ContractRepository) GetContract(contractHash string) (core.Contract, error)

type DBLogFilter

type DBLogFilter struct {
	ID int
	*filters.LogFilter
	Topics DBTopics
}

type DBTopics

type DBTopics []*string

func (*DBTopics) Scan

func (t *DBTopics) Scan(src interface{}) error

type FilterRepository

type FilterRepository struct {
	*postgres.DB
}

func (FilterRepository) CreateFilter

func (filterRepository FilterRepository) CreateFilter(query filters.LogFilter) error

func (FilterRepository) GetFilter

func (filterRepository FilterRepository) GetFilter(name string) (filters.LogFilter, error)

type FullSyncLogRepository added in v0.0.7

type FullSyncLogRepository struct {
	*postgres.DB
}

func (FullSyncLogRepository) CreateLogs added in v0.0.7

func (repository FullSyncLogRepository) CreateLogs(lgs []core.FullSyncLog, receiptId int64) error

func (FullSyncLogRepository) GetLogs added in v0.0.7

func (repository FullSyncLogRepository) GetLogs(address string, blockNumber int64) ([]core.FullSyncLog, error)

type FullSyncReceiptRepository added in v0.0.6

type FullSyncReceiptRepository struct {
	*postgres.DB
}

func (FullSyncReceiptRepository) CreateFullSyncReceiptInTx added in v0.0.6

func (FullSyncReceiptRepository) CreateFullSyncReceiptInTx(blockId int64, receipt core.Receipt, tx *sqlx.Tx) (int64, error)

func (FullSyncReceiptRepository) CreateReceiptsAndLogs added in v0.0.6

func (receiptRepository FullSyncReceiptRepository) CreateReceiptsAndLogs(blockId int64, receipts []core.Receipt) error

func (FullSyncReceiptRepository) GetFullSyncReceipt added in v0.0.6

func (receiptRepository FullSyncReceiptRepository) GetFullSyncReceipt(txHash string) (core.Receipt, error)

type HeaderRepository

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

func NewHeaderRepository

func NewHeaderRepository(database *postgres.DB) HeaderRepository

func (HeaderRepository) CreateOrUpdateHeader

func (repository HeaderRepository) CreateOrUpdateHeader(header core.Header) (int64, error)

func (HeaderRepository) CreateTransactionInTx

func (repository HeaderRepository) CreateTransactionInTx(tx *sqlx.Tx, headerID int64, transaction core.TransactionModel) (int64, error)

func (HeaderRepository) CreateTransactions

func (repository HeaderRepository) CreateTransactions(headerID int64, transactions []core.TransactionModel) error

func (HeaderRepository) GetHeader

func (repository HeaderRepository) GetHeader(blockNumber int64) (core.Header, error)

func (HeaderRepository) InternalInsertHeader added in v0.0.9

func (repository HeaderRepository) InternalInsertHeader(header core.Header) (int64, error)

Function is public so we can test insert being called for the same header Can happen when concurrent processes are inserting headers Otherwise should not occur since only called in CreateOrUpdateHeader

func (HeaderRepository) MissingBlockNumbers

func (repository HeaderRepository) MissingBlockNumbers(startingBlockNumber, endingBlockNumber int64, nodeID string) ([]int64, error)

type HeaderSyncLogRepository added in v0.0.7

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

func NewHeaderSyncLogRepository added in v0.0.7

func NewHeaderSyncLogRepository(db *postgres.DB) HeaderSyncLogRepository

func (HeaderSyncLogRepository) CreateHeaderSyncLogs added in v0.0.7

func (repo HeaderSyncLogRepository) CreateHeaderSyncLogs(headerID int64, logs []types.Log) error

func (HeaderSyncLogRepository) GetUntransformedHeaderSyncLogs added in v0.0.7

func (repo HeaderSyncLogRepository) GetUntransformedHeaderSyncLogs() ([]core.HeaderSyncLog, error)

type HeaderSyncReceiptRepository added in v0.0.6

type HeaderSyncReceiptRepository struct{}

func (HeaderSyncReceiptRepository) CreateHeaderSyncReceiptInTx added in v0.0.6

func (HeaderSyncReceiptRepository) CreateHeaderSyncReceiptInTx(headerID, transactionID int64, receipt core.Receipt, tx *sqlx.Tx) (int64, error)

type WatchedEventRepository

type WatchedEventRepository struct {
	*postgres.DB
}

func (WatchedEventRepository) GetWatchedEvents

func (watchedEventRepository WatchedEventRepository) GetWatchedEvents(name string) ([]*core.WatchedEvent, error)

Jump to

Keyboard shortcuts

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