indexer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetIndexBlockSequences = iota + 1
	TargetIndexValidatorSessionSequences
	TargetIndexValidatorEraSequences
	TargetIndexValidatorAggregates
	TargetIndexEventSequences
)
View Source
const (
	BlockParserTaskName      = "BlockParser"
	ValidatorsParserTaskName = "ValidatorsParser"
)
View Source
const (
	SyncerPersistorTaskName              = "SyncerPersistor"
	BlockSeqPersistorTaskName            = "BlockSeqPersistor"
	ValidatorSessionSeqPersistorTaskName = "ValidatorSessionSeqPersistor"
	ValidatorEraSeqPersistorTaskName     = "ValidatorEraSeqPersistor"
	ValidatorAggPersistorTaskName        = "ValidatorAggPersistor"
	EventSeqPersistorTaskName            = "EventSeqPersistor"
)
View Source
const (
	BlockSeqCreatorTaskName            = "BlockSeqCreator"
	ValidatorSessionSeqCreatorTaskName = "ValidatorSessionSeqCreator"
	ValidatorEraSeqCreatorTaskName     = "ValidatorEraSeqCreator"
	EventSeqCreatorTaskName            = "EventSeqCreator"
)
View Source
const (
	CtxReport = "context_report"
)
View Source
const (
	FetcherTaskName = "Fetcher"
)
View Source
const (
	MainSyncerTaskName = "MainSyncer"
)
View Source
const (
	ValidatorAggCreatorTaskName = "ValidatorAggCreator"
)

Variables

View Source
var (
	ErrBlockSequenceNotValid            = errors.New("block sequence not valid")
	ErrValidatorSessionSequenceNotValid = errors.New("validator session sequence not valid")
	ErrValidatorEraSequenceNotValid     = errors.New("validator era sequence not valid")
	ErrEventSequenceNotValid            = errors.New("event 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 EventToSequence added in v0.1.2

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

func NewBackfillSource

func NewBackfillSource(cfg *config.Config, db *store.Store, client *client.Client, indexVersion int64) (*backfillSource, error)

func NewBlockParserTask

func NewBlockParserTask() *blockParserTask

func NewBlockSeqCreatorTask

func NewBlockSeqCreatorTask(db *store.Store) *blockSeqCreatorTask

NewBlockSeqCreatorTask creates block sequences

func NewBlockSeqPersistorTask

func NewBlockSeqPersistorTask(db *store.Store) 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 NewEventSeqCreatorTask added in v0.1.2

func NewEventSeqCreatorTask(db *store.Store) *eventSeqCreatorTask

NewEventSeqCreatorTask creates block sequences

func NewEventSeqPersistorTask added in v0.1.2

func NewEventSeqPersistorTask(db *store.Store) 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, db *store.Store, client *client.Client, sourceCfg *IndexSourceConfig) (*indexSource, error)

func NewLogger

func NewLogger() pipeline.Logger

func NewMainSyncerTask

func NewMainSyncerTask(db *store.Store) pipeline.Task

func NewPayloadFactory

func NewPayloadFactory() *payloadFactory

func NewPipeline

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

func NewSink

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

func NewSyncerPersistorTask

func NewSyncerPersistorTask(db *store.Store) pipeline.Task

NewSyncerPersistorTask is responsible for storing syncable to persistence layer

func NewValidatorAggCreatorTask added in v0.1.2

func NewValidatorAggCreatorTask(db *store.Store) *validatorAggCreatorTask

func NewValidatorAggPersistorTask added in v0.1.2

func NewValidatorAggPersistorTask(db *store.Store) pipeline.Task

func NewValidatorEraSeqCreatorTask added in v0.1.2

func NewValidatorEraSeqCreatorTask(cfg *config.Config, db *store.Store) *validatorEraSeqCreatorTask

NewValidatorEraSeqCreatorTask creates validator era sequences

func NewValidatorEraSeqPersistorTask added in v0.1.2

func NewValidatorEraSeqPersistorTask(db *store.Store) pipeline.Task

NewValidatorEraSeqPersistorTask is responsible for storing validator era info to persistence layer

func NewValidatorSessionSeqCreatorTask added in v0.1.2

func NewValidatorSessionSeqCreatorTask(cfg *config.Config, db *store.Store) *validatorSessionSeqCreatorTask

NewValidatorSessionSeqCreatorTask creates validator session sequences

func NewValidatorSessionSeqPersistorTask added in v0.1.2

func NewValidatorSessionSeqPersistorTask(db *store.Store) pipeline.Task

NewValidatorSessionSeqPersistorTask is responsible for storing validator session info to persistence layer

func NewValidatorsParserTask added in v0.1.2

func NewValidatorsParserTask() *validatorsParserTask

func ToBlockSequence added in v0.1.2

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

func ToValidatorEraSequence added in v0.1.2

func ToValidatorEraSequence(syncable *model.Syncable, firstHeight int64, rawStakingValidator []*stakingpb.Validator) ([]model.ValidatorEraSeq, 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
	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 PipelineSyncableStore added in v0.2.0

type PipelineSyncableStore interface {
	FindSmallestIndexVersion() (*int64, error)
}

type ReportStore added in v0.2.0

type ReportStore interface {
	FindNotCompletedByIndexVersion(int64, ...model.ReportKind) (*model.Report, error)
	Create(interface{}) error
	Save(interface{}) error
}

type RunConfig

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

Jump to

Keyboard shortcuts

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