indexer

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskNameAccountAggCreator   = "AccountAggCreator"
	TaskNameValidatorAggCreator = "ValidatorAggCreator"
)
View Source
const (
	IndexTargetBlockSequences = iota + 1
	IndexTargetValidatorSequences
	IndexTargetValidatorAggregates
	IndexTargetSystemEvents
	IndexValidatorRewards
	IndexBalanceEvents
)
View Source
const (
	TaskNameBlockFetcher        = "BlockFetcher"
	TaskNameTransactionFetcher  = "TransactionFetcher"
	TaskNameEventFetcher        = "EventsFetcher"
	TaskNameStateFetcher        = "StateFetcher"
	TaskNameStakingStateFetcher = "StakingStateFetcher"
	TaskNameValidatorFetcher    = "ValidatorFetcher"
)
View Source
const (
	TaskNameBlockParser      = "BlockParser"
	TaskNameValidatorsParser = "ValidatorsParser"
	TaskNameBalanceParser    = "BalanceParser"
)
View Source
const (
	TaskNameBalanceEventPersistor = "BalanceEventPersistor"
	TaskNameSyncerPersistor       = "SyncerPersistor"
	TaskNameBlockSeqPersistor     = "BlockSeqPersistor"
	TaskNameValidatorSeqPersistor = "ValidatorSeqPersistor"
	TaskNameValidatorAggPersistor = "ValidatorAggPersistor"
	TaskNameSystemEventPersistor  = "SystemEventPersistor"
)
View Source
const (
	CtxReport = "context_report"

	StageAnalyzer = "AnalyzerStage"
)
View Source
const (
	TaskNameBlockSeqCreator               = "BlockSeqCreator"
	TaskNameValidatorSeqCreator           = "ValidatorSeqCreator"
	TaskNameTransactionSeqCreator         = "TransactionSeqCreator"
	TaskNameStakingSeqCreator             = "StakingSeqCreator"
	TaskNameDelegationSeqCreator          = "DelegationSeqCreator"
	TaskNameDebondingDelegationSeqCreator = "DebondingDelegationSeqCreator"
)
View Source
const (
	TaskNameHeightMetaRetriever = "HeightMetaRetriever"
)
View Source
const (
	TaskNameMainSyncer = "MainSyncer"
)
View Source
const (
	TaskNameSystemEventCreator = "SystemEventCreator"
)

Variables

View Source
var (
	ErrActiveEscrowBalanceOutsideOfRange = errors.New("active escrow balance is outside of specified buckets")
	ErrCommissionOutsideOfRange          = errors.New("commission is outside of specified buckets")

	MaxValidatorSequences int64 = 1000
	MissedForMaxThreshold int64 = 50
	MissedInRowThreshold  int64 = 50
)
View Source
var (
	ErrIsPristine          = errors.New("cannot run because database is empty")
	ErrIndexCannotBeRun    = errors.New("cannot run index process")
	ErrBackfillCannotBeRun = errors.New("cannot run backfill process")
)
View Source
var (
	ErrAccountAggNotValid = errors.New("account aggregator not valid")
)
View Source
var (
	ErrNothingToBackfill = errors.New("nothing to backfill")
)
View Source
var (
	ErrNothingToProcess = errors.New("nothing to process")
)

Functions

func BlockToSequence

func BlockToSequence(syncable *model.Syncable, blockParsedData ParsedBlockData) (*model.BlockSeq, error)

func DebondingDelegationToSequence

func DebondingDelegationToSequence(syncable *model.Syncable, rawState *statepb.State) ([]model.DebondingDelegationSeq, error)

func DelegationToSequence

func DelegationToSequence(syncable *model.Syncable, rawState *statepb.State) ([]model.DelegationSeq, error)

func NewAccountAggCreatorTask

func NewAccountAggCreatorTask(db AccountAggCreatorTaskStore) *accountAggCreatorTask

func NewBackfillSource added in v0.4.2

func NewBackfillSource(cfg *config.Config, db BackfillSourceStore, civ int64) (*backfillSource, error)

func NewBalanceEventPersistorTask added in v0.6.0

func NewBalanceEventPersistorTask(db BalanceEventPersistorTaskStore) pipeline.Task

func NewBalanceParserTask added in v0.6.0

func NewBalanceParserTask() *balanceParserTask

func NewBlockFetcherTask

func NewBlockFetcherTask(client client.BlockClient) pipeline.Task

func NewBlockParserTask added in v0.4.0

func NewBlockParserTask() *blockParserTask

func NewBlockSeqCreatorTask

func NewBlockSeqCreatorTask(db BlockSeqCreatorTaskStore) *blockSeqCreatorTask

func NewBlockSeqPersistorTask added in v0.4.2

func NewBlockSeqPersistorTask(db BlockSeqPersistorTaskStore) pipeline.Task

func NewConfigParser added in v0.5.0

func NewConfigParser(file string) (*configParser, error)

func NewDebondingDelegationsSeqCreatorTask

func NewDebondingDelegationsSeqCreatorTask(db DebondingDelegationSeqCreatorTaskStore) *debondingDelegationSeqCreatorTask

func NewDelegationsSeqCreatorTask

func NewDelegationsSeqCreatorTask(db DelegationSeqCreatorTaskStore) *delegationSeqCreatorTask

func NewEventsFetcherTask added in v0.5.2

func NewEventsFetcherTask(client client.EventClient) pipeline.Task

func NewHeightMetaRetrieverTask

func NewHeightMetaRetrieverTask(c client.ChainClient) pipeline.Task

func NewIndexSource added in v0.4.2

func NewIndexSource(cfg *config.Config, db SourceIndexStore, client client.ChainClient, startHeight int64, batchSize int64) (*indexSource, error)

func NewLogger added in v0.4.2

func NewLogger() pipeline.Logger

func NewMainSyncerTask

func NewMainSyncerTask(db SyncerTaskStore) pipeline.Task

func NewPayloadFactory

func NewPayloadFactory(constants *chainpb.GetConstantsResponse) *payloadFactory

func NewPipeline

func NewPipeline(cfg *config.Config, db *store.Store, client *client.Client) (*indexingPipeline, error)

func NewReindexSource added in v0.9.0

func NewReindexSource(cfg *config.Config, db ReindexSourceStore, startHeight, endHeight int64) (*reindexSource, error)

func NewSink

func NewSink(db *store.Store, versionNumber int64) *sink

func NewStakingSeqCreatorTask

func NewStakingSeqCreatorTask(db StakingSeqCreatorTaskStore) *stakingSeqCreatorTask

func NewStakingStateFetcherTask added in v0.4.0

func NewStakingStateFetcherTask(client client.StateClient) pipeline.Task

func NewStateFetcherTask

func NewStateFetcherTask(client client.StateClient) pipeline.Task

func NewSyncerPersistorTask added in v0.4.2

func NewSyncerPersistorTask(db SyncerPersistorTaskStore) pipeline.Task

func NewSystemEventCreatorTask added in v0.5.0

func NewSystemEventCreatorTask(cfg *config.Config, s SystemEventCreatorStore) *systemEventCreatorTask

NewSystemEventCreatorTask creates system events

func NewSystemEventPersistorTask added in v0.5.0

func NewSystemEventPersistorTask(db SystemEventPersistorTaskStore) pipeline.Task

func NewTransactionFetcherTask

func NewTransactionFetcherTask(client client.TransactionClient) pipeline.Task

func NewTransactionSeqCreatorTask

func NewTransactionSeqCreatorTask(db TransactionSeqCreatorTaskStore) *transactionSeqCreatorTask

func NewValidatorAggCreatorTask

func NewValidatorAggCreatorTask(db ValidatorAggCreatorTaskStore) *validatorAggCreatorTask

func NewValidatorAggPersistorTask added in v0.4.2

func NewValidatorAggPersistorTask(db ValidatorAggPersistorTaskStore) pipeline.Task

func NewValidatorFetcherTask

func NewValidatorFetcherTask(client client.ValidatorClient) pipeline.Task

func NewValidatorSeqCreatorTask

func NewValidatorSeqCreatorTask(db ValidatorSeqCreatorTaskStore) *validatorSeqCreatorTask

func NewValidatorSeqPersistorTask added in v0.4.2

func NewValidatorSeqPersistorTask(db ValidatorSeqPersistorTaskStore) pipeline.Task

func NewValidatorsParserTask added in v0.4.0

func NewValidatorsParserTask() *validatorsParserTask

func StakingToSequence

func StakingToSequence(syncable *model.Syncable, rawStaking *statepb.Staking) (*model.StakingSeq, error)

func TransactionToSequence

func TransactionToSequence(syncable *model.Syncable, rawTransactions []*transactionpb.Transaction) ([]model.TransactionSeq, error)

func ValidatorToSequence

func ValidatorToSequence(syncable *model.Syncable, rawValidators []*validatorpb.Validator, parsedValidators ParsedValidatorsData) ([]model.ValidatorSeq, error)

Types

type AccountAggCreatorTaskStore added in v0.5.2

type AccountAggCreatorTaskStore interface {
	FindByPublicKey(key string) (*model.AccountAgg, error)
	Create(record interface{}) error
	Save(record interface{}) error
}

type BackfillConfig added in v0.4.2

type BackfillConfig struct {
	Parallel bool
	Force    bool
}

type BackfillSourceStore added in v0.5.2

type BackfillSourceStore interface {
	FindFirstByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
	FindMostRecentByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
}

type BalanceEventPersistorTaskStore added in v0.6.0

type BalanceEventPersistorTaskStore interface {
	CreateOrUpdate(*model.BalanceEvent) error
}

type BlockFetcherTask

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

func (*BlockFetcherTask) GetName added in v0.4.0

func (t *BlockFetcherTask) GetName() string

func (*BlockFetcherTask) Run

type BlockSeqCreatorTaskStore added in v0.5.2

type BlockSeqCreatorTaskStore interface {
	FindByHeight(height int64) (*model.BlockSeq, error)
}

type BlockSeqPersistorTaskStore added in v0.5.2

type BlockSeqPersistorTaskStore interface {
	Create(record interface{}) error
	Save(record interface{}) error
}

type ConfigParser added in v0.5.0

type ConfigParser interface {
	GetCurrentVersionId() int64
	GetAllVersionedVersionIds() []int64
	IsAnyVersionSequential(versionIds []int64) bool
	GetAllAvailableTasks() []pipeline.TaskName
	GetAllVersionedTasks() ([]pipeline.TaskName, error)
	GetTasksByVersionIds([]int64) ([]pipeline.TaskName, error)
	GetTasksByTargetIds([]int64) ([]pipeline.TaskName, error)
}

type DebondingDelegationSeqCreatorTaskStore added in v0.5.2

type DebondingDelegationSeqCreatorTaskStore interface {
	Create(record interface{}) error
	FindByHeight(h int64) ([]model.DebondingDelegationSeq, error)
}

type DelegationSeqCreatorTaskStore added in v0.5.2

type DelegationSeqCreatorTaskStore interface {
	Create(record interface{}) error
	FindByHeight(h int64) ([]model.DelegationSeq, error)
}

type EventsFetcherTask added in v0.5.2

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

func (*EventsFetcherTask) GetName added in v0.5.2

func (t *EventsFetcherTask) GetName() string

func (*EventsFetcherTask) Run added in v0.5.2

type HeightMeta

type HeightMeta struct {
	Height       int64
	Time         types.Time
	AppVersion   uint64
	BlockVersion uint64
}

type IndexConfig added in v0.5.0

type IndexConfig struct {
	StartHeight int64
	BatchSize   int64
}

type ParsedBlockData

type ParsedBlockData struct {
	TransactionsCount int64
	ProposerEntityUID string
}

type ParsedValidatorsData

type ParsedValidatorsData map[string]parsedValidator

type ReindexConfig added in v0.9.0

type ReindexConfig struct {
	Parallel    bool
	StartHeight int64
	EndHeight   int64
	TargetIds   []int64
}

type ReindexSourceStore added in v0.9.0

type ReindexSourceStore interface {
	FindMostRecent() (*model.Syncable, error)
}

type RunConfig added in v0.4.2

type RunConfig struct {
	Height            int64
	DesiredVersionIDs []int64
	DesiredTargetIDs  []int64
	Dry               bool
}

type SourceIndexStore added in v0.5.2

type SourceIndexStore interface {
	FindMostRecent() (*model.Syncable, error)
}

type StakingSeqCreatorTaskStore added in v0.5.2

type StakingSeqCreatorTaskStore interface {
	Create(record interface{}) error
	FindByHeight(height int64) (*model.StakingSeq, error)
}

type StakingStateFetcherTask added in v0.4.0

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

func (*StakingStateFetcherTask) GetName added in v0.4.0

func (t *StakingStateFetcherTask) GetName() string

func (*StakingStateFetcherTask) Run added in v0.4.0

type StateFetcherTask

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

func (*StateFetcherTask) GetName added in v0.4.0

func (t *StateFetcherTask) GetName() string

func (*StateFetcherTask) Run

type SyncerPersistorTaskStore added in v0.5.2

type SyncerPersistorTaskStore interface {
	CreateOrUpdate(val *model.Syncable) error
}

type SyncerTaskStore added in v0.5.2

type SyncerTaskStore interface {
	FindByHeight(height int64) (*model.Syncable, error)
}

type SystemEventCreatorStore added in v0.5.0

type SystemEventCreatorStore interface {
	FindByHeight(int64) ([]model.ValidatorSeq, error)
	FindLastByAddress(string, int64) ([]model.ValidatorSeq, error)
}

type SystemEventPersistorTaskStore added in v0.5.2

type SystemEventPersistorTaskStore interface {
	CreateOrUpdate(*model.SystemEvent) error
}

type TransactionFetcherTask

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

func (*TransactionFetcherTask) GetName added in v0.4.0

func (t *TransactionFetcherTask) GetName() string

func (*TransactionFetcherTask) Run

type TransactionSeqCreatorTaskStore added in v0.5.2

type TransactionSeqCreatorTaskStore interface {
	Create(record interface{}) error
	FindByHeight(h int64) ([]model.TransactionSeq, error)
}

type ValidatorAggCreatorTaskStore added in v0.5.2

type ValidatorAggCreatorTaskStore interface {
	FindByEntityUID(key string) (*model.ValidatorAgg, error)
}

type ValidatorAggPersistorTaskStore added in v0.5.2

type ValidatorAggPersistorTaskStore interface {
	Create(record interface{}) error
	Save(record interface{}) error
}

type ValidatorFetcherTask

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

func (*ValidatorFetcherTask) GetName added in v0.4.0

func (t *ValidatorFetcherTask) GetName() string

func (*ValidatorFetcherTask) Run

type ValidatorSeqCreatorTaskStore added in v0.5.2

type ValidatorSeqCreatorTaskStore interface {
	FindByHeightAndEntityUID(h int64, key string) (*model.ValidatorSeq, error)
}

type ValidatorSeqPersistorTaskStore added in v0.5.2

type ValidatorSeqPersistorTaskStore interface {
	Create(record interface{}) error
	Save(record interface{}) error
}

Jump to

Keyboard shortcuts

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