indexer

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ValidatorAggCreatorTaskName      = "ValidatorAggCreator"
	ValidatorGroupAggCreatorTaskName = "ValidatorGroupAggCreator"
	ProposalAggCreatorTaskName       = "ProposalAggCreator"
)
View Source
const (
	TargetIndexBlockSequences = iota + 1
	TargetIndexValidatorSequences
	TargetIndexValidatorGroupSequences
	TargetIndexValidatorAggregates
	TargetIndexValidatorGroupAggregates
)
View Source
const (
	TaskNameBlockFetcher           = "BlockFetcher"
	TaskNameValidatorsFetcher      = "ValidatorsFetcher"
	TaskNameValidatorGroupsFetcher = "ValidatorGroupsFetcher"
	TaskNameTransactionsFetcher    = "TransactionsFetcher"
)
View Source
const (
	SyncerPersistorTaskName                = "SyncerPersistor"
	BlockSeqPersistorTaskName              = "BlockSeqPersistor"
	ValidatorSeqPersistorTaskName          = "ValidatorSeqPersistor"
	ValidatorGroupSeqPersistorTaskName     = "ValidatorGroupSeqPersistor"
	AccountActivitySeqPersistorTaskName    = "AccountActivitySeqPersistor"
	ValidatorAggPersistorTaskName          = "ValidatorAggPersistor"
	ValidatorGroupAggPersistorTaskName     = "ValidatorGroupAggPersistor"
	ProposalAggPersistorTaskName           = "ProposalAggPersistor"
	TaskNameSystemEventPersistor           = "SystemEventPersistor"
	GovernanceActivitySeqPersistorTaskName = "GovernanceActivitySeqPersistor"
)
View Source
const (
	BlockSeqCreatorTaskName              = "BlockSeqCreator"
	ValidatorSeqCreatorTaskName          = "ValidatorSeqCreator"
	ValidatorGroupSeqCreatorTaskName     = "ValidatorGroupSeqCreator"
	AccountActivitySeqCreatorTaskName    = "AccountActivitySeqCreator"
	GovernanceActivitySeqCreatorTaskName = "GovernanceActivitySeqCreator"
)
View Source
const (
	CtxReport = "context_report"
)
View Source
const (
	MainSyncerTaskName = "MainSyncer"
)
View Source
const (
	TaskNameGovernanceLogsParser = "GovernanceLogsParser"
)
View Source
const (
	TaskNameHeightMetaRetriever = "HeightMetaRetriever"
)
View Source
const (
	TaskNameSystemEventCreator = "SystemEventCreator"
)

Variables

View Source
var (
	ErrGroupRewardOutsideOfRange = errors.New("group reward is outside of specified buckets")

	MaxValidatorSequences int64 = 1000
	MissedForMaxThreshold int64 = 50
	MissedInRowThreshold  int64 = 50
)
View Source
var (
	OperationTypeInternalTransferReceived                     = fmt.Sprintf("%sReceived", figmentclient.OperationTypeInternalTransfer)
	OperationTypeInternalTransferSent                         = fmt.Sprintf("%sSent", figmentclient.OperationTypeInternalTransfer)
	OperationTypeValidatorGroupVoteCastReceived               = fmt.Sprintf("%sReceived", figmentclient.OperationTypeValidatorGroupVoteCast)
	OperationTypeValidatorGroupVoteCastSent                   = fmt.Sprintf("%sSent", figmentclient.OperationTypeValidatorGroupVoteCast)
	OperationTypeValidatorGroupVoteActivatedReceived          = fmt.Sprintf("%sReceived", figmentclient.OperationTypeValidatorGroupVoteActivated)
	OperationTypeValidatorGroupVoteActivatedSent              = fmt.Sprintf("%sSent", figmentclient.OperationTypeValidatorGroupVoteActivated)
	OperationTypeValidatorGroupPendingVoteRevokedReceived     = fmt.Sprintf("%sReceived", figmentclient.OperationTypeValidatorGroupPendingVoteRevoked)
	OperationTypeValidatorGroupPendingVoteRevokedSent         = fmt.Sprintf("%sSent", figmentclient.OperationTypeValidatorGroupPendingVoteRevoked)
	OperationTypeValidatorGroupActiveVoteRevokedReceived      = fmt.Sprintf("%sReceived", figmentclient.OperationTypeValidatorGroupActiveVoteRevoked)
	OperationTypeValidatorGroupActiveVoteRevokedSent          = fmt.Sprintf("%sSent", figmentclient.OperationTypeValidatorGroupActiveVoteRevoked)
	OperationTypeValidatorEpochPaymentDistributedForGroup     = fmt.Sprintf("%sForGroup", figmentclient.OperationTypeValidatorEpochPaymentDistributed)
	OperationTypeValidatorEpochPaymentDistributedForValidator = fmt.Sprintf("%sForValidator", figmentclient.OperationTypeValidatorEpochPaymentDistributed)

	ErrBlockSequenceNotValid          = errors.New("block sequence not valid")
	ErrValidatorSequenceNotValid      = errors.New("validator sequence not valid")
	ErrValidatorGroupSequenceNotValid = errors.New("validator group sequence not valid")
)
View Source
var (
	StageAnalyzer pipeline.StageName = "stage_analyzer"

	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 NewAccountActivitySeqCreatorTask added in v0.1.0

func NewAccountActivitySeqCreatorTask(cfg *config.Config, db *store.Store) *accountActivitySeqCreatorTask

NewAccountActivitySeqCreatorTask creates account activity sequences

func NewAccountActivitySeqPersistorTask added in v0.1.0

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

NewAccountActivitySeqPersistorTask is responsible for storing validator info to persistence layer

func NewBackfillSource

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

func NewBlockFetcherTask

func NewBlockFetcherTask(client figmentclient.Client) pipeline.Task

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

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

func NewGovernanceActivitySeqCreatorTask added in v0.1.0

func NewGovernanceActivitySeqCreatorTask(cfg *config.Config, db *store.Store) *governanceActivitySeqCreatorTask

NewGovernanceActivitySeqCreatorTask creates account activity sequences

func NewGovernanceActivitySeqPersistorTask added in v0.1.0

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

NewGovernanceActivitySeqPersistorTask is responsible for storing validator info to persistence layer

func NewGovernanceLogsParserTask added in v0.1.0

func NewGovernanceLogsParserTask() *governanceLogsParserTask

NewGovernanceLogsParserTask parses transaction logs to data about governance

func NewHeightMetaRetrieverTask

func NewHeightMetaRetrieverTask(c figmentclient.Client) *heightMetaRetrieverTask

func NewIndexSource

func NewIndexSource(cfg *config.Config, db *store.Store, client figmentclient.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 figmentclient.Client) (*indexingPipeline, error)

func NewProposalAggCreatorTask added in v0.1.0

func NewProposalAggCreatorTask(db *store.Store) *proposalAggCreatorTask

func NewProposalAggPersistorTask added in v0.1.0

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

NewProposalAggPersistorTask store validator aggregate to persistence layer

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 NewSystemEventCreatorTask added in v0.1.0

func NewSystemEventCreatorTask(cfg *config.Config, db *store.Store) *systemEventCreatorTask

NewSystemEventCreatorTask creates system events

func NewSystemEventPersistorTask added in v0.1.0

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

NewSystemEventPersistorTask store system events to persistance layer

func NewTransactionFetcherTask added in v0.1.0

func NewTransactionFetcherTask(client figmentclient.Client) pipeline.Task

func NewValidatorAggCreatorTask

func NewValidatorAggCreatorTask(db *store.Store) *validatorAggCreatorTask

func NewValidatorAggPersistorTask

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

NewValidatorAggPersistorTask store validator aggregate to persistence layer

func NewValidatorFetcherTask

func NewValidatorFetcherTask(client figmentclient.Client) pipeline.Task

func NewValidatorGroupAggCreatorTask

func NewValidatorGroupAggCreatorTask(db *store.Store) *validatorGroupAggCreatorTask

func NewValidatorGroupAggPersistorTask

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

NewValidatorGroupAggPersistorTask store validator group aggregate to persistence layer

func NewValidatorGroupFetcherTask

func NewValidatorGroupFetcherTask(client figmentclient.Client) pipeline.Task

func NewValidatorGroupSeqCreatorTask

func NewValidatorGroupSeqCreatorTask(cfg *config.Config, db *store.Store) *validatorGroupSeqCreatorTask

NewValidatorGroupSeqCreatorTask creates validator era sequences

func NewValidatorGroupSeqPersistorTask

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

NewValidatorGroupSeqPersistorTask is responsible for storing validator era info to persistence layer

func NewValidatorSeqCreatorTask

func NewValidatorSeqCreatorTask(cfg *config.Config, db *store.Store) *validatorSeqCreatorTask

NewValidatorSeqCreatorTask creates validator sequences

func NewValidatorSeqPersistorTask

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

NewValidatorSeqPersistorTask is responsible for storing validator info to persistence layer

func ToAccountActivitySequence added in v0.1.0

func ToAccountActivitySequence(syncable *model.Syncable, rawTransactions []*figmentclient.Transaction) ([]model.AccountActivitySeq, error)

func ToBlockSequence

func ToBlockSequence(syncable *model.Syncable, rawBlock *figmentclient.Block) (*model.BlockSeq, error)

func ToGovernanceActivitySequence added in v0.1.0

func ToGovernanceActivitySequence(syncable *model.Syncable, parsedGovernanceLogs []*ParsedGovernanceLogs) ([]model.GovernanceActivitySeq, error)

func ToValidatorGroupSequence

func ToValidatorGroupSequence(syncable *model.Syncable, rawValidatorGroups []*figmentclient.ValidatorGroup, rawValidators []*figmentclient.Validator) ([]model.ValidatorGroupSeq, error)

func ToValidatorSequence

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

Types

type BackfillConfig

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

type BlockFetcherTask

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

func (*BlockFetcherTask) GetName

func (t *BlockFetcherTask) GetName() string

func (*BlockFetcherTask) Run

type ConfigParser

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 HeightMeta

type HeightMeta struct {
	ChainId     uint64
	Height      int64
	Time        *types.Time
	Epoch       *int64
	EpochSize   *int64
	LastInEpoch *bool
}

type IndexConfig

type IndexConfig struct {
	BatchSize   int64
	StartHeight int64
}

type IndexSourceConfig

type IndexSourceConfig struct {
	BatchSize   int64
	StartHeight int64
}

type ParsedGovernanceLogs added in v0.1.0

type ParsedGovernanceLogs struct {
	ProposalId      uint64
	TransactionHash string
	Kind            string
	Details         interface{}
}

type PipelineSyncableStore

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

type ReportStore

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
}

type TransactionsFetcherTask added in v0.1.0

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

func (*TransactionsFetcherTask) GetName added in v0.1.0

func (t *TransactionsFetcherTask) GetName() string

func (*TransactionsFetcherTask) Run added in v0.1.0

type ValidatorGroupsFetcherTask

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

func (*ValidatorGroupsFetcherTask) GetName

func (t *ValidatorGroupsFetcherTask) GetName() string

func (*ValidatorGroupsFetcherTask) Run

type ValidatorsFetcherTask

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

func (*ValidatorsFetcherTask) GetName

func (t *ValidatorsFetcherTask) GetName() string

func (*ValidatorsFetcherTask) Run

Jump to

Keyboard shortcuts

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