indexer

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 35 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                     = "FetchAll"
	ValidatorFetcherTaskName            = "ValidatorFetcher"
	ValidatorPerformanceFetcherTaskName = "ValidatorPerformanceFetcher"
)
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"
)
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, 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,
	accountDb store.Accounts,
	blockDb store.Blocks,
	databaseDb store.Database,
	eventDb store.Events,
	reportDb store.Reports,
	rewardDb store.Rewards,
	rewardStore *RewardStore,
	syncableDb store.Syncables,
	systemEventDb store.SystemEvents,
	transactionDb store.Transactions,
	validatorDb store.Validators,
	datastoreClient datastore.DatastoreServiceClient,
) (*indexingPipeline, error)

func NewReindexSource added in v0.8.3

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

func NewRewardEraSeqCreatorTask added in v0.6.0

func NewRewardEraSeqCreatorTask(cfg *config.Config, rewardsDb store.Rewards, syncablesDb store.Syncables, validatorDb store.ValidatorEraSeq) *rewardEraSeqCreatorTask

NewRewardEraSeqCreatorTask creates rewards

func NewRewardEraSeqPersistorTask added in v0.6.0

func NewRewardEraSeqPersistorTask(rewardsDb store.Rewards, rewardStore *RewardStore) 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 *datastore.FetcherClientWrapper) pipeline.Task

func NewValidatorPerformanceFetcherTask added in v0.9.2

func NewValidatorPerformanceFetcherTask(client *datastore.FetcherClientWrapper) 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, 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.Transaction) ([]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
	GetAllTasks(verionIds, targetIds []int64) ([]pipeline.TaskName, error)
}

type ErrorValue added in v0.10.2

type ErrorValue struct {
	Module Module `json:"module"`
}

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
	ActiveEra       int64
	LastInSession   bool
	LastInEra       bool
	LastInActiveEra 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 Module added in v0.10.2

type Module struct {
	Index    int         `json:"index"`
	ErrorRaw interface{} `json:"error"`
	Error    int         `json:"-"`
}

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 ReindexConfig added in v0.8.3

type ReindexConfig struct {
	Parallel  bool
	Force     bool
	TargetIds []int64

	LastInSession bool
	LastInEra     bool
	TrxKinds      []model.TransactionKind
	StartHeight   int64
	EndHeight     int64
	// contains filtered or unexported fields
}

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 RewardStore added in v0.13.0

type RewardStore struct {
	C       *http.Client
	URL     string
	Network string
	ChainID string
}

func NewRewardStore added in v0.13.0

func NewRewardStore(c *http.Client, url string, network string, chainid string) *RewardStore

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
	TxHash         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

type ValidatorPerformanceFetcherTask added in v0.9.2

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

func (*ValidatorPerformanceFetcherTask) GetName added in v0.9.2

func (*ValidatorPerformanceFetcherTask) Run added in v0.9.2

Jump to

Keyboard shortcuts

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