Documentation ¶
Index ¶
- Variables
- func BlocksTableName(blockchain string) string
- func CheckVariablesForIndexer() error
- func GetJobIds(abiJobs []AbiJob, isSilent bool) []string
- func InitDBConnection()
- func IsBlockchainWithL1Chain(blockchain string) bool
- func LabelsTableName(blockchain string) string
- func PrintContractSignatures(abiString string) (interface{}, error)
- func ReadIndicesFromFile(filePath string) ([]interface{}, error)
- func TransactionsTableName(blockchain string) string
- func WriteIndicesToDatabase(blockchain string, blocks []BlockIndex) error
- func WriteIndicesToFile(indices []interface{}, filePath string) error
- type AbiEntry
- type AbiJob
- type AbiJobsDeployInfo
- type BlockCache
- type BlockIndex
- type CustomerUpdates
- type EventLabel
- type IndexType
- type PostgreSQLpgx
- func (p *PostgreSQLpgx) CleanIndexes(blockchain string, batchLimit uint64, sleepTime int) error
- func (p *PostgreSQLpgx) Close()
- func (p *PostgreSQLpgx) CopyAbiJobs(sourceCustomerId, destCustomerId string, abiJobs []AbiJob) error
- func (p *PostgreSQLpgx) CreateJobsFromAbi(chain string, address string, abiFile string, customerID string, userID string, ...) error
- func (p *PostgreSQLpgx) DeleteJobs(jobIds []string) error
- func (p *PostgreSQLpgx) EnsureCorrectSelectors(blockchain string, WriteToDB bool, outputFilePath string, ids []string) error
- func (p *PostgreSQLpgx) FindBatchPath(blockchain string, blockNumber uint64) (string, uint64, uint64, error)
- func (p *PostgreSQLpgx) GetAbiJobsWithoutDeployBlocks(blockchain string) (map[string]map[string][]string, error)
- func (p *PostgreSQLpgx) GetCustomersIDs(blockchain string) ([]string, error)
- func (p *PostgreSQLpgx) GetEdgeDBBlock(ctx context.Context, blockchain, side string) (BlockIndex, error)
- func (p *PostgreSQLpgx) GetLatestDBBlockNumber(blockchain string, reverse ...bool) (uint64, error)
- func (p *PostgreSQLpgx) GetPool() *pgxpool.Pool
- func (p *PostgreSQLpgx) ReadABIJobs(blockchain string) ([]AbiJob, error)
- func (p *PostgreSQLpgx) ReadBlockIndex(ctx context.Context, startBlock uint64, endBlock uint64) ([]BlockIndex, error)
- func (p *PostgreSQLpgx) ReadIndexOnRange(tableName string, startBlock uint64, endBlock uint64) ([]interface{}, error)
- func (p *PostgreSQLpgx) ReadLastLabel(blockchain string) (uint64, error)
- func (p *PostgreSQLpgx) ReadUpdates(blockchain string, fromBlock uint64, customerIds []string, minBlocksToSync int) (uint64, uint64, []string, []CustomerUpdates, error)
- func (p *PostgreSQLpgx) RetrievePathsAndBlockBounds(blockchain string, blockNumber uint64, minBlocksToSync int) ([]string, uint64, uint64, error)
- func (p *PostgreSQLpgx) SelectAbiJobs(blockchain string, addresses []string, customersIds []string, ...) ([]AbiJob, error)
- func (p *PostgreSQLpgx) UpdateAbiJobsDeployBlock(blockNumber uint64, ids []string) error
- func (p *PostgreSQLpgx) UpdateAbiJobsStatus(blockchain string) error
- func (p *PostgreSQLpgx) UpdateAbisAsDone(ids []string) error
- func (p *PostgreSQLpgx) UpdateAbisProgress(ids []string, process int) error
- func (p *PostgreSQLpgx) WriteEvents(tx pgx.Tx, blockchain string, events []EventLabel) error
- func (p *PostgreSQLpgx) WriteIndexes(blockchain string, blocksIndexPack []BlockIndex) error
- func (p *PostgreSQLpgx) WriteLabes(blockchain string, transactions []TransactionLabel, events []EventLabel) error
- func (p *PostgreSQLpgx) WriteTransactions(tx pgx.Tx, blockchain string, transactions []TransactionLabel) error
- type TaskForLog
- type TaskForTransaction
- type TransactionLabel
- type UnnestInsertValueStruct
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InsertBatchSize = 1000 // Number of rows to insert in a single batch parameters_amount_per_row * InsertBatchSize <= 65535 InsertMaxParametersPerBatch = 65535 SeerCrawlerLabel string MOONSTREAM_DB_V3_INDEXES_URI string SeerCrawlerRawLabel string )
Functions ¶
func BlocksTableName ¶
func CheckVariablesForIndexer ¶
func CheckVariablesForIndexer() error
func InitDBConnection ¶
func InitDBConnection()
init initializes the DBConnection variable with a new PostgreSQLpgx instance.
func IsBlockchainWithL1Chain ¶
func LabelsTableName ¶
func PrintContractSignatures ¶
Print contract function and event signatures from the ABI
func ReadIndicesFromFile ¶
ReadIndicesFromFile reads indices from a JSON file into a slice of interface{}.
func TransactionsTableName ¶
func WriteIndicesToDatabase ¶
func WriteIndicesToDatabase(blockchain string, blocks []BlockIndex) error
WriteIndicesToDatabase writes the given indices to the database
func WriteIndicesToFile ¶
Types ¶
type AbiJob ¶
type AbiJob struct { ID string Address []byte UserID string CustomerID string AbiSelector string Chain string AbiName string Status string HistoricalCrawlStatus string Progress int MoonwormTaskPickedup bool Abi string AbiType string CreatedAt time.Time UpdatedAt time.Time DeploymentBlockNumber *uint64 }
func FilterABIJobs ¶
type AbiJobsDeployInfo ¶
type BlockCache ¶
type BlockIndex ¶
type BlockIndex struct { BlockNumber uint64 BlockHash string BlockTimestamp uint64 ParentHash string RowID uint64 Path string L1BlockNumber uint64 // contains filtered or unexported fields }
func NewBlockIndex ¶
func NewBlockIndex(chain string, blockNumber uint64, blockHash string, blockTimestamp uint64, parentHash string, row_id uint64, path string, l1BlockNumber uint64) BlockIndex
NewBlockIndex creates a new instance of BlockIndex with the chain set.
func (*BlockIndex) SetChain ¶
func (b *BlockIndex) SetChain(chain string)
type CustomerUpdates ¶
type CustomerUpdates struct { CustomerID string `json:"customer_id"` Abis map[string]map[string]*AbiEntry `json:"abis"` LastBlock uint64 `json:"last_block"` Path string `json:"path"` }
func ConvertToCustomerUpdatedAndDeployBlockDicts ¶ added in v0.3.5
func ConvertToCustomerUpdatedAndDeployBlockDicts(abiJobs []AbiJob) ([]CustomerUpdates, map[string]AbiJobsDeployInfo, error)
type EventLabel ¶
type PostgreSQLpgx ¶
type PostgreSQLpgx struct {
// contains filtered or unexported fields
}
var DBConnection *PostgreSQLpgx
func NewPostgreSQLpgx ¶
func NewPostgreSQLpgx() (*PostgreSQLpgx, error)
func NewPostgreSQLpgxWithCustomURI ¶
func NewPostgreSQLpgxWithCustomURI(uri string) (*PostgreSQLpgx, error)
func (*PostgreSQLpgx) CleanIndexes ¶
func (p *PostgreSQLpgx) CleanIndexes(blockchain string, batchLimit uint64, sleepTime int) error
func (*PostgreSQLpgx) Close ¶
func (p *PostgreSQLpgx) Close()
func (*PostgreSQLpgx) CopyAbiJobs ¶ added in v0.3.5
func (p *PostgreSQLpgx) CopyAbiJobs(sourceCustomerId, destCustomerId string, abiJobs []AbiJob) error
func (*PostgreSQLpgx) CreateJobsFromAbi ¶
func (*PostgreSQLpgx) DeleteJobs ¶ added in v0.3.5
func (p *PostgreSQLpgx) DeleteJobs(jobIds []string) error
func (*PostgreSQLpgx) EnsureCorrectSelectors ¶
func (*PostgreSQLpgx) FindBatchPath ¶
func (*PostgreSQLpgx) GetAbiJobsWithoutDeployBlocks ¶
func (*PostgreSQLpgx) GetCustomersIDs ¶
func (p *PostgreSQLpgx) GetCustomersIDs(blockchain string) ([]string, error)
func (*PostgreSQLpgx) GetEdgeDBBlock ¶
func (p *PostgreSQLpgx) GetEdgeDBBlock(ctx context.Context, blockchain, side string) (BlockIndex, error)
GetEdgeDBBlock fetch first or last block for specified blockchain
func (*PostgreSQLpgx) GetLatestDBBlockNumber ¶
func (p *PostgreSQLpgx) GetLatestDBBlockNumber(blockchain string, reverse ...bool) (uint64, error)
func (*PostgreSQLpgx) GetPool ¶
func (p *PostgreSQLpgx) GetPool() *pgxpool.Pool
func (*PostgreSQLpgx) ReadABIJobs ¶
func (p *PostgreSQLpgx) ReadABIJobs(blockchain string) ([]AbiJob, error)
func (*PostgreSQLpgx) ReadBlockIndex ¶
func (p *PostgreSQLpgx) ReadBlockIndex(ctx context.Context, startBlock uint64, endBlock uint64) ([]BlockIndex, error)
func (*PostgreSQLpgx) ReadIndexOnRange ¶
func (p *PostgreSQLpgx) ReadIndexOnRange(tableName string, startBlock uint64, endBlock uint64) ([]interface{}, error)
func (*PostgreSQLpgx) ReadLastLabel ¶
func (p *PostgreSQLpgx) ReadLastLabel(blockchain string) (uint64, error)
func (*PostgreSQLpgx) ReadUpdates ¶
func (p *PostgreSQLpgx) ReadUpdates(blockchain string, fromBlock uint64, customerIds []string, minBlocksToSync int) (uint64, uint64, []string, []CustomerUpdates, error)
func (*PostgreSQLpgx) RetrievePathsAndBlockBounds ¶ added in v0.3.14
func (*PostgreSQLpgx) SelectAbiJobs ¶
func (*PostgreSQLpgx) UpdateAbiJobsDeployBlock ¶
func (p *PostgreSQLpgx) UpdateAbiJobsDeployBlock(blockNumber uint64, ids []string) error
func (*PostgreSQLpgx) UpdateAbiJobsStatus ¶
func (p *PostgreSQLpgx) UpdateAbiJobsStatus(blockchain string) error
func (*PostgreSQLpgx) UpdateAbisAsDone ¶
func (p *PostgreSQLpgx) UpdateAbisAsDone(ids []string) error
func (*PostgreSQLpgx) UpdateAbisProgress ¶
func (p *PostgreSQLpgx) UpdateAbisProgress(ids []string, process int) error
func (*PostgreSQLpgx) WriteEvents ¶
func (p *PostgreSQLpgx) WriteEvents(tx pgx.Tx, blockchain string, events []EventLabel) error
func (*PostgreSQLpgx) WriteIndexes ¶
func (p *PostgreSQLpgx) WriteIndexes(blockchain string, blocksIndexPack []BlockIndex) error
func (*PostgreSQLpgx) WriteLabes ¶
func (p *PostgreSQLpgx) WriteLabes( blockchain string, transactions []TransactionLabel, events []EventLabel, ) error
func (*PostgreSQLpgx) WriteTransactions ¶
func (p *PostgreSQLpgx) WriteTransactions(tx pgx.Tx, blockchain string, transactions []TransactionLabel) error
type TaskForLog ¶
type TaskForTransaction ¶
type TransactionLabel ¶
type UnnestInsertValueStruct ¶
type UnnestInsertValueStruct struct { Type string `json:"type"` // e.g. "BIGINT" or "TEXT" or any other PostgreSQL data type Values []interface{} `json:"values"` // e.g. [1, 2, 3, 4, 5] }
https://klotzandrew.com/blog/postgres-passing-65535-parameter-limit/ insted of batching
Click to show internal directories.
Click to hide internal directories.