indexer

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskNameEraSystemEventCreator     = "EraSystemEventCreator"
	TaskNameSessionSystemEventCreator = "SessionSystemEventCreator"
	TaskNameSystemEventCreator        = "SystemEventCreator"
)
View Source
const (
	TargetIndexBlockSequences = iota + 1
	TargetIndexValidatorSessionSequences
	TargetIndexValidatorEraSequences
	TargetIndexValidatorAggregates
	TargetIndexEventSequences
)
View Source
const (
	FetcherTaskName          = "Fetcher"
	ValidatorFetcherTaskName = "ValidatorFetcher"
)
View Source
const (
	BlockParserTaskName      = "BlockParser"
	ValidatorsParserTaskName = "ValidatorsParser"
)
View Source
const (
	SyncerPersistorTaskName              = "SyncerPersistor"
	BlockSeqPersistorTaskName            = "BlockSeqPersistor"
	ValidatorSessionSeqPersistorTaskName = "ValidatorSessionSeqPersistor"
	ValidatorEraSeqPersistorTaskName     = "ValidatorEraSeqPersistor"
	ValidatorAggPersistorTaskName        = "ValidatorAggPersistor"
	EventSeqPersistorTaskName            = "EventSeqPersistor"
	AccountEraSeqPersistorTaskName       = "AccountEraSeqPersistor"
	TransactionSeqPersistorTaskName      = "TransactionSeqPersistor"
	ValidatorSeqPersistorTaskName        = "ValidatorSeqPersistor"
	SystemEventPersistorTaskName         = "SystemEventPersistor"
	RewardEraSeqPersistorTaskName        = "RewardEraSeqPersistor"
)
View Source
const (
	CtxReport = "context_report"

	StageAnalyzer = "AnalyzerStage"
)
View Source
const (
	BlockSeqCreatorTaskName            = "BlockSeqCreator"
	ValidatorSeqCreatorTaskName        = "ValidatorSeqCreator"
	ValidatorSessionSeqCreatorTaskName = "ValidatorSessionSeqCreator"
	ValidatorEraSeqCreatorTaskName     = "ValidatorEraSeqCreator"
	EventSeqCreatorTaskName            = "EventSeqCreator"
	AccountEraSeqCreatorTaskName       = "AccountEraSeqCreator"
	TransactionSeqCreatorTaskName      = "TransactionSeqCreator"
	RewardEraSeqCreatorTaskName        = "RewardEraSeqCreator"
	ClaimedRewardEraSeqCreatorTaskName = "ClaimedRewardEraSeqCreator"
)
View Source
const (
	MainSyncerTaskName = "MainSyncer"
)
View Source
const (
	ValidatorAggCreatorTaskName = "ValidatorAggCreator"
)

Variables

View Source
var (
	ErrActiveBalanceOutsideOfRange = errors.New("active balance is outside of specified buckets")
	ErrCommissionOutsideOfRange    = errors.New("commission is outside of specified buckets")
)
View Source
var (
	ErrBlockSequenceNotValid            = errors.New("block sequence not valid")
	ErrValidatorSequenceNotValid        = errors.New("validator sequence not valid")
	ErrValidatorSessionSequenceNotValid = errors.New("validator session sequence not valid")
	ErrValidatorEraSequenceNotValid     = errors.New("validator era sequence not valid")
	ErrAccountEraSequenceNotValid       = errors.New("account era sequence not valid")
	ErrEventSequenceNotValid            = errors.New("event sequence not valid")
	ErrTransactionSequenceNotValid      = errors.New("transaction sequence not valid")
)
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 (
	ErrNothingToProcess = errors.New("nothing to process")
)

Functions

func NewAccountEraSeqCreatorTask added in v0.3.0

func NewAccountEraSeqCreatorTask(cfg *config.Config, accountEraSeqDb store.AccountEraSeq, syncablesDb store.Syncables) *accountEraSeqCreatorTask

NewAccountEraSeqCreatorTask creates account era sequences

func NewAccountEraSeqPersistorTask added in v0.3.0

func NewAccountEraSeqPersistorTask(accountEraSeqDb store.AccountEraSeq) pipeline.Task

NewAccountEraSeqPersistorTask is responsible for storing account era info to persistence layer

func NewBackfillSource

func NewBackfillSource(cfg *config.Config, syncablesDb store.Syncables, client *client.Client, indexVersion int64, isLastInSession, isLastInEra bool, transactionDb store.Transactions, trxFilter []model.TransactionKind) (*backfillSource, error)

func NewBlockParserTask

func NewBlockParserTask() *blockParserTask

func NewBlockSeqCreatorTask

func NewBlockSeqCreatorTask(blockSeqDb store.BlockSeq) *blockSeqCreatorTask

NewBlockSeqCreatorTask creates block sequences

func NewBlockSeqPersistorTask

func NewBlockSeqPersistorTask(blockSeqDb store.BlockSeq) pipeline.Task

NewBlockSeqPersistorTask is responsible for storing block to persistence layer

func NewConfigParser added in v0.2.0

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

func NewEraSystemEventCreatorTask added in v0.5.0

func NewEraSystemEventCreatorTask(cfg *config.Config, accountEraSeqDb store.AccountEraSeq, validatorEraSeqDb store.ValidatorEraSeq) *eraSystemEventCreatorTask

NewEraSystemEventCreatorTask creates system events

func NewEventSeqCreatorTask added in v0.1.2

func NewEventSeqCreatorTask(eventSeqDb store.EventSeq) *eventSeqCreatorTask

NewEventSeqCreatorTask creates block sequences

func NewEventSeqPersistorTask added in v0.1.2

func NewEventSeqPersistorTask(eventSeqDb store.EventSeq) pipeline.Task

NewEventSeqPersistorTask is responsible for storing events info to persistence layer

func NewFetcherTask added in v0.1.2

func NewFetcherTask(client FetcherClient) pipeline.Task

func NewIndexSource

func NewIndexSource(cfg *config.Config, syncablesDb store.Syncables, client *client.Client, sourceCfg *IndexSourceConfig) (*indexSource, error)

func NewLogger

func NewLogger() pipeline.Logger

func NewMainSyncerTask

func NewMainSyncerTask(syncablesDb store.Syncables) pipeline.Task

func NewPayloadFactory

func NewPayloadFactory() *payloadFactory

func NewPipeline

func NewPipeline(cfg *config.Config, cli *client.Client, accountDb store.Accounts, blockDb store.Blocks, databaseDb store.Database, eventDb store.Events, reportDb store.Reports,
	rewardDb store.Rewards, syncableDb store.Syncables, systemEventDb store.SystemEvents, transactionDb store.Transactions, validatorDb store.Validators,
) (*indexingPipeline, error)

func NewRewardEraSeqCreatorTask added in v0.6.0

func NewRewardEraSeqCreatorTask(cfg *config.Config, syncablesDb store.Syncables) *rewardEraSeqCreatorTask

NewRewardEraSeqCreatorTask creates rewards

func NewRewardEraSeqPersistorTask added in v0.6.0

func NewRewardEraSeqPersistorTask(rewardsDb store.Rewards) pipeline.Task

func NewSessionSystemEventCreatorTask added in v0.5.0

func NewSessionSystemEventCreatorTask(cfg *config.Config, syncablesDb store.Syncables, systemEventDb store.SystemEvents, validatorSeqDb store.ValidatorSeq, validatorSessionSeqDb store.ValidatorSessionSeq,
) *sessionSystemEventCreatorTask

NewSessionSystemEventCreatorTask creates system events

func NewSink

func NewSink(databaseDb store.Database, syncablesDb store.Syncables, versionNumber int64) *sink

func NewSyncerPersistorTask

func NewSyncerPersistorTask(syncablesDb store.Syncables) pipeline.Task

NewSyncerPersistorTask is responsible for storing syncable to persistence layer

func NewSystemEventCreatorTask added in v0.5.0

func NewSystemEventCreatorTask(cfg *config.Config, validatorSeqDb store.ValidatorSeq) *systemEventCreatorTask

NewSystemEventCreatorTask creates system events

func NewSystemEventPersistorTask added in v0.5.0

func NewSystemEventPersistorTask(systemEventDb store.SystemEvents) pipeline.Task

func NewTransactionSeqCreatorTask added in v0.4.4

func NewTransactionSeqCreatorTask(transactionSeqDb store.TransactionSeq) *transactionSeqCreatorTask

NewTransactionSeqCreatorTask creates block sequences

func NewTransactionSeqPersistorTask added in v0.4.4

func NewTransactionSeqPersistorTask(transactionSeqDb store.TransactionSeq) pipeline.Task

NewTransactionSeqPersistorTask is responsible for storing transaction info to persistence layer

func NewValidatorAggCreatorTask added in v0.1.2

func NewValidatorAggCreatorTask(validatorAggDb store.ValidatorAgg) *validatorAggCreatorTask

func NewValidatorAggPersistorTask added in v0.1.2

func NewValidatorAggPersistorTask(validatorAggDb store.ValidatorAgg) pipeline.Task

func NewValidatorEraSeqCreatorTask added in v0.1.2

func NewValidatorEraSeqCreatorTask(cfg *config.Config, syncablesDb store.Syncables, validatorEraSeqDb store.ValidatorEraSeq) *validatorEraSeqCreatorTask

NewValidatorEraSeqCreatorTask creates validator era sequences

func NewValidatorEraSeqPersistorTask added in v0.1.2

func NewValidatorEraSeqPersistorTask(validatorEraSeqDb store.ValidatorEraSeq) pipeline.Task

NewValidatorEraSeqPersistorTask is responsible for storing validator era info to persistence layer

func NewValidatorFetcherTask added in v0.5.0

func NewValidatorFetcherTask(client client.ValidatorClient) pipeline.Task

func NewValidatorSeqCreatorTask added in v0.5.0

func NewValidatorSeqCreatorTask(validatorSeqDb store.ValidatorSeq) *validatorSeqCreatorTask

NewValidatorSeqCreatorTask creates validator sequences

func NewValidatorSeqPersistorTask added in v0.5.0

func NewValidatorSeqPersistorTask(ValidatorSeqDb store.ValidatorSeq) pipeline.Task

NewValidatorSeqPersistorTask is responsible for storing transaction info to persistence layer

func NewValidatorSessionSeqCreatorTask added in v0.1.2

func NewValidatorSessionSeqCreatorTask(cfg *config.Config, syncablesDb store.Syncables, validatorSessionSeqDb store.ValidatorSessionSeq) *validatorSessionSeqCreatorTask

NewValidatorSessionSeqCreatorTask creates validator session sequences

func NewValidatorSessionSeqPersistorTask added in v0.1.2

func NewValidatorSessionSeqPersistorTask(validatorSessionSeqDb store.ValidatorSessionSeq) pipeline.Task

NewValidatorSessionSeqPersistorTask is responsible for storing validator session info to persistence layer

func NewValidatorsParserTask added in v0.1.2

func NewValidatorsParserTask(cfg *config.Config, accountClient client.AccountClient, rewardsDb store.Rewards, syncablesDb store.Syncables, validatorDb store.ValidatorEraSeq) *validatorsParserTask

func ToAccountEraSequence added in v0.3.0

func ToAccountEraSequence(syncable *model.Syncable, firstHeight int64, rawStakingValidator *stakingpb.Validator) ([]model.AccountEraSeq, error)

func ToBlockSequence added in v0.1.2

func ToBlockSequence(syncable *model.Syncable, rawBlock *blockpb.Block, blockParsedData ParsedBlockData) (*model.BlockSeq, error)

func ToEventSequence added in v0.3.0

func ToEventSequence(syncable *model.Syncable, rawEvents []*eventpb.Event) ([]model.EventSeq, error)

func ToTransactionSequence added in v0.4.4

func ToTransactionSequence(syncable *model.Syncable, rawTransactions []*transactionpb.Annotated) ([]model.TransactionSeq, error)

func ToValidatorEraSequence added in v0.1.2

func ToValidatorEraSequence(syncable *model.Syncable, firstHeight int64, rawStakingValidator []*stakingpb.Validator) ([]model.ValidatorEraSeq, error)

func ToValidatorSequence added in v0.5.0

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

func ToValidatorSessionSequence added in v0.1.2

func ToValidatorSessionSequence(syncable *model.Syncable, firstHeight int64, rawValidatorPerformance []*validatorperformancepb.Validator) ([]model.ValidatorSessionSeq, error)

Types

type BackfillConfig

type BackfillConfig struct {
	Parallel  bool
	Force     bool
	TargetIds []int64
}

type ConfigParser added in v0.2.0

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

type FetcherClient added in v0.1.2

type FetcherClient interface {
	GetAll(int64) (*heightpb.GetAllResponse, error)
}

type FetcherTask added in v0.1.2

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

func (*FetcherTask) GetName added in v0.1.2

func (t *FetcherTask) GetName() string

func (*FetcherTask) Run added in v0.1.2

type HeightMeta

type HeightMeta struct {
	Height        int64
	Time          types.Time
	SpecVersion   string
	ChainUID      string
	Session       int64
	Era           int64
	LastInSession bool
	LastInEra     bool
}

type IndexConfig added in v0.2.0

type IndexConfig struct {
	BatchSize   int64
	StartHeight int64
}

type IndexSourceConfig

type IndexSourceConfig struct {
	BatchSize   int64
	StartHeight int64
}

type ParsedBlockData

type ParsedBlockData struct {
	ExtrinsicsCount         int64
	UnsignedExtrinsicsCount int64
	SignedExtrinsicsCount   int64
}

type ParsedValidatorsData added in v0.1.2

type ParsedValidatorsData map[string]parsedValidator

ParsedValidatorsData normalized validator data

type RewardEraSeqPersistorTask added in v0.6.0

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

func (*RewardEraSeqPersistorTask) GetName added in v0.6.0

func (t *RewardEraSeqPersistorTask) GetName() string

func (*RewardEraSeqPersistorTask) Run added in v0.6.0

type RewardsCalculator added in v0.6.0

type RewardsCalculator interface {
	// contains filtered or unexported methods
}

type RewardsClaim added in v0.6.0

type RewardsClaim struct {
	Era            int64
	ValidatorStash string
}

type RunConfig

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

type ValidatorFetcherTask added in v0.5.0

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

func (*ValidatorFetcherTask) GetName added in v0.5.0

func (t *ValidatorFetcherTask) GetName() string

func (*ValidatorFetcherTask) Run added in v0.5.0

Jump to

Keyboard shortcuts

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