store

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type AccountEraSeqStore added in v0.3.0

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

AccountEraSeqStore handles operations on accounts

func NewAccountEraSeqStore added in v0.3.0

func NewAccountEraSeqStore(db *gorm.DB) *AccountEraSeqStore

func (AccountEraSeqStore) Create added in v0.3.0

func (s AccountEraSeqStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (AccountEraSeqStore) DeleteByHeight added in v0.3.0

func (s AccountEraSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*AccountEraSeqStore) DeleteOlderThan added in v0.3.0

func (s *AccountEraSeqStore) DeleteOlderThan(purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deletes account sequence older than given threshold

func (AccountEraSeqStore) FindByEra added in v0.3.0

func (s AccountEraSeqStore) FindByEra(era int64) ([]model.AccountEraSeq, error)

FindByHeight finds account era sequences by era

func (AccountEraSeqStore) FindByEraAndStashAccount added in v0.3.0

func (s AccountEraSeqStore) FindByEraAndStashAccount(era int64, stash string) (*model.AccountEraSeq, error)

FindByEraAndStashAccount finds account by era and stash account

func (AccountEraSeqStore) FindByEraAndStashAccounts added in v0.3.0

func (s AccountEraSeqStore) FindByEraAndStashAccounts(era int64, stash string, validatorStash string) (*model.AccountEraSeq, error)

FindByEraAndStashAccounts finds account era sequence by era and stash accounts

func (AccountEraSeqStore) FindByHeight added in v0.3.0

func (s AccountEraSeqStore) FindByHeight(h int64) ([]model.AccountEraSeq, error)

FindByHeight finds account era sequences by height

func (AccountEraSeqStore) FindByHeightAndStashAccounts added in v0.3.0

func (s AccountEraSeqStore) FindByHeightAndStashAccounts(height int64, stash string, validatorStash string) (*model.AccountEraSeq, error)

FindByHeightAndStashAccount finds account are sequence by height and stash accounts

func (AccountEraSeqStore) FindLastByStashAccount added in v0.3.0

func (s AccountEraSeqStore) FindLastByStashAccount(stashAccount string, eraLimit int64) ([]model.AccountEraSeq, error)

FindLastByStashAccount finds last account era sequences for given stash account and era limit

func (AccountEraSeqStore) FindLastByValidatorStashAccount added in v0.3.0

func (s AccountEraSeqStore) FindLastByValidatorStashAccount(validatorStashAccount string, eraLimit int64) ([]model.AccountEraSeq, error)

FindLastByValidatorStashAccount finds last account era sequences for given validator stash account and era limit

func (*AccountEraSeqStore) FindMostRecent added in v0.3.0

func (s *AccountEraSeqStore) FindMostRecent() (*model.AccountEraSeq, error)

FindMostRecent finds most recent account era sequence

func (AccountEraSeqStore) Save added in v0.3.0

func (s AccountEraSeqStore) Save(record interface{}) error

Save saves record to database

func (AccountEraSeqStore) Truncate added in v0.3.0

func (s AccountEraSeqStore) Truncate() error

Truncate removes all records from the table

func (AccountEraSeqStore) Update added in v0.3.0

func (s AccountEraSeqStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type ActivityPeriodRow

type ActivityPeriodRow struct {
	Period int64
	Min    types.Time
	Max    types.Time
}

type BlockSeqStore

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

BlockSeqStore handles operations on blocks

func NewBlockSeqStore

func NewBlockSeqStore(db *gorm.DB) *BlockSeqStore

func (BlockSeqStore) Create

func (s BlockSeqStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (BlockSeqStore) CreateIfNotExists

func (s BlockSeqStore) CreateIfNotExists(block *model.BlockSeq) error

CreateIfNotExists creates the block if it does not exist

func (BlockSeqStore) DeleteByHeight

func (s BlockSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*BlockSeqStore) DeleteOlderThan

func (s *BlockSeqStore) DeleteOlderThan(purgeThreshold time.Time, activityPeriods []ActivityPeriodRow) (*int64, error)

DeleteOlderThan deletes block sequence older than given threshold

func (BlockSeqStore) FindBy

func (s BlockSeqStore) FindBy(key string, value interface{}) (*model.BlockSeq, error)

FindBy returns a block for a matching attribute

func (BlockSeqStore) FindByHeight

func (s BlockSeqStore) FindByHeight(height int64) (*model.BlockSeq, error)

FindByHeight returns a block with the matching height

func (BlockSeqStore) FindByID

func (s BlockSeqStore) FindByID(id int64) (*model.BlockSeq, error)

FindByID returns a block with matching ID

func (*BlockSeqStore) FindMostRecent

func (s *BlockSeqStore) FindMostRecent() (*model.BlockSeq, error)

FindMostRecent finds most recent block sequence

func (*BlockSeqStore) GetAvgRecentTimes

func (s *BlockSeqStore) GetAvgRecentTimes(limit int64) GetAvgRecentTimesResult

GetAvgRecentTimes Gets average block times for recent blocks by limit

func (BlockSeqStore) Save

func (s BlockSeqStore) Save(record interface{}) error

Save saves record to database

func (*BlockSeqStore) Summarize

func (s *BlockSeqStore) Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]BlockSeqSummary, error)

Summarize gets the summarized version of block sequences

func (BlockSeqStore) Truncate

func (s BlockSeqStore) Truncate() error

Truncate removes all records from the table

func (BlockSeqStore) Update

func (s BlockSeqStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type BlockSeqSummary

type BlockSeqSummary struct {
	TimeBucket   types.Time `json:"time_bucket"`
	Count        int64      `json:"count"`
	BlockTimeAvg float64    `json:"block_time_avg"`
}

type BlockSummaryStore

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

BlockSummaryStore handles operations on block summary

func NewBlockSummaryStore

func NewBlockSummaryStore(db *gorm.DB) *BlockSummaryStore

func (BlockSummaryStore) Create

func (s BlockSummaryStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (BlockSummaryStore) DeleteByHeight

func (s BlockSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*BlockSummaryStore) DeleteOlderThan

func (s *BlockSummaryStore) DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deletes block summary records older than given threshold

func (BlockSummaryStore) Find

Find find block summary by query

func (*BlockSummaryStore) FindActivityPeriods

func (s *BlockSummaryStore) FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)

FindActivityPeriods Finds activity periods

func (*BlockSummaryStore) FindMostRecent

func (s *BlockSummaryStore) FindMostRecent() (*model.BlockSummary, error)

FindMostRecent finds most recent block summary

func (*BlockSummaryStore) FindMostRecentByInterval

func (s *BlockSummaryStore) FindMostRecentByInterval(interval types.SummaryInterval) (*model.BlockSummary, error)

FindMostRecentByInterval finds most recent block summary for given time interval

func (*BlockSummaryStore) FindSummary

func (s *BlockSummaryStore) FindSummary(interval types.SummaryInterval, period string) ([]model.BlockSummary, error)

FindSummary Gets summary of block sequences

func (BlockSummaryStore) Save

func (s BlockSummaryStore) Save(record interface{}) error

Save saves record to database

func (BlockSummaryStore) Truncate

func (s BlockSummaryStore) Truncate() error

Truncate removes all records from the table

func (BlockSummaryStore) Update

func (s BlockSummaryStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type DatabaseStore

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

DatabaseStore handles operations on blocks

func NewDatabaseStore

func NewDatabaseStore(db *gorm.DB) *DatabaseStore

func (*DatabaseStore) GetTotalSize

func (s *DatabaseStore) GetTotalSize() (*GetTotalSizeResult, error)

FindSummary Gets average block times for interval

type EventSeqStore added in v0.1.2

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

EventSeqStore handles operations on events

func NewEventSeqStore added in v0.1.2

func NewEventSeqStore(db *gorm.DB) *EventSeqStore

func (EventSeqStore) Create added in v0.1.2

func (s EventSeqStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (EventSeqStore) DeleteByHeight added in v0.1.2

func (s EventSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*EventSeqStore) DeleteOlderThan added in v0.1.2

func (s *EventSeqStore) DeleteOlderThan(purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deletes event sequence older than given threshold

func (EventSeqStore) FindBalanceDeposits added in v0.1.2

func (s EventSeqStore) FindBalanceDeposits(address string) ([]model.EventSeq, error)

FindBalanceDeposits finds balance deposits event sequences for given address

func (EventSeqStore) FindBalanceTransfers added in v0.1.2

func (s EventSeqStore) FindBalanceTransfers(address string) ([]model.EventSeq, error)

FindBalanceTransfers finds balance transfers event sequences for given address

func (EventSeqStore) FindBonded added in v0.1.2

func (s EventSeqStore) FindBonded(address string) ([]model.EventSeq, error)

FindBonded finds bonded event sequences for given address

func (EventSeqStore) FindByHeight added in v0.1.2

func (s EventSeqStore) FindByHeight(height int64) ([]model.EventSeq, error)

FindByHeight finds event sequences by height

func (EventSeqStore) FindByHeightAndIndex added in v0.1.2

func (s EventSeqStore) FindByHeightAndIndex(height int64, index int64) (*model.EventSeq, error)

FindByHeightAndStashAccount finds event by height and index

func (*EventSeqStore) FindMostRecent added in v0.1.2

func (s *EventSeqStore) FindMostRecent() (*model.EventSeq, error)

FindMostRecent finds most recent event session sequence

func (EventSeqStore) FindUnbonded added in v0.1.2

func (s EventSeqStore) FindUnbonded(address string) ([]model.EventSeq, error)

FindBonded finds unbonded event sequences for given address

func (EventSeqStore) FindWithdrawn added in v0.1.2

func (s EventSeqStore) FindWithdrawn(address string) ([]model.EventSeq, error)

FindBonded finds withdrawn event sequences for given address

func (EventSeqStore) Save added in v0.1.2

func (s EventSeqStore) Save(record interface{}) error

Save saves record to database

func (EventSeqStore) Truncate added in v0.1.2

func (s EventSeqStore) Truncate() error

Truncate removes all records from the table

func (EventSeqStore) Update added in v0.1.2

func (s EventSeqStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type GetAvgRecentTimesResult

type GetAvgRecentTimesResult struct {
	StartHeight int64   `json:"start_height"`
	EndHeight   int64   `json:"end_height"`
	StartTime   string  `json:"start_time"`
	EndTime     string  `json:"end_time"`
	Count       int64   `json:"count"`
	Diff        float64 `json:"diff"`
	Avg         float64 `json:"avg"`
}

GetAvgRecentTimesResult Contains results for GetAvgRecentTimes query

type GetAvgTimesForIntervalRow

type GetAvgTimesForIntervalRow struct {
	TimeInterval string  `json:"time_interval"`
	Count        int64   `json:"count"`
	Avg          float64 `json:"avg"`
}

GetAvgTimesForIntervalRow Contains row of data for FindSummary query

type GetTotalSizeResult

type GetTotalSizeResult struct {
	Size float64 `json:"size"`
}

GetAvgTimesForIntervalRow Contains row of data for FindSummary query

type ReportsStore

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

ReportsStore handles operations on reports

func NewReportsStore

func NewReportsStore(db *gorm.DB) *ReportsStore

func (ReportsStore) Create

func (s ReportsStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (ReportsStore) DeleteByHeight

func (s ReportsStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ReportsStore) DeleteByKinds added in v0.2.0

func (s *ReportsStore) DeleteByKinds(kinds []model.ReportKind) error

DeleteByKinds deletes reports with kind reindexing sequential or parallel

func (ReportsStore) FindNotCompletedByIndexVersion

func (s ReportsStore) FindNotCompletedByIndexVersion(indexVersion int64, kinds ...model.ReportKind) (*model.Report, error)

FindNotCompletedByIndexVersion returns the report by index version and kind

func (ReportsStore) FindNotCompletedByKind

func (s ReportsStore) FindNotCompletedByKind(kinds ...model.ReportKind) (*model.Report, error)

Last returns the last report

func (ReportsStore) Last

func (s ReportsStore) Last() (*model.Report, error)

Last returns the last report

func (ReportsStore) Save

func (s ReportsStore) Save(record interface{}) error

Save saves record to database

func (ReportsStore) Truncate

func (s ReportsStore) Truncate() error

Truncate removes all records from the table

func (ReportsStore) Update

func (s ReportsStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type Store

type Store struct {
	Database  *DatabaseStore
	Syncables *SyncablesStore
	Reports   *ReportsStore

	BlockSeq            *BlockSeqStore
	ValidatorSessionSeq *ValidatorSessionSeqStore
	ValidatorEraSeq     *ValidatorEraSeqStore
	EventSeq            *EventSeqStore
	AccountEraSeq       *AccountEraSeqStore

	ValidatorAgg *ValidatorAggStore

	BlockSummary     *BlockSummaryStore
	ValidatorSummary *ValidatorSummaryStore
	// contains filtered or unexported fields
}

Store handles all database operations

func New

func New(connStr string) (*Store, error)

NewIndexerMetric returns a new store from the connection string

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection

func (*Store) SetDebugMode

func (s *Store) SetDebugMode(enabled bool)

SetDebugMode enabled detailed query logging

func (*Store) Test

func (s *Store) Test() error

Test checks the connection status

type SyncablesStore

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

SyncablesStore handles operations on syncables

func NewSyncablesStore

func NewSyncablesStore(db *gorm.DB) *SyncablesStore

func (SyncablesStore) Create

func (s SyncablesStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (SyncablesStore) CreateOrUpdate

func (s SyncablesStore) CreateOrUpdate(val *model.Syncable) error

CreateOrUpdate creates a new syncable or updates an existing one

func (SyncablesStore) DeleteByHeight

func (s SyncablesStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (SyncablesStore) FindByHeight

func (s SyncablesStore) FindByHeight(height int64) (syncable *model.Syncable, err error)

Exists returns true if a syncable exists at give height

func (SyncablesStore) FindFirstByDifferentIndexVersion

func (s SyncablesStore) FindFirstByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)

FindFirstByDifferentIndexVersion returns first syncable with different index version

func (SyncablesStore) FindLastInEra added in v0.1.2

func (s SyncablesStore) FindLastInEra(era int64) (syncable *model.Syncable, err error)

FindLastInEra finds last syncable in given era

func (SyncablesStore) FindLastInSession added in v0.1.2

func (s SyncablesStore) FindLastInSession(session int64) (syncable *model.Syncable, err error)

FindLastInSession finds last syncable in given session

func (SyncablesStore) FindMostRecent

func (s SyncablesStore) FindMostRecent() (*model.Syncable, error)

FindMostRecent returns the most recent syncable

func (SyncablesStore) FindMostRecentByDifferentIndexVersion

func (s SyncablesStore) FindMostRecentByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)

FindMostRecentByDifferentIndexVersion returns the most recent syncable with different index version

func (SyncablesStore) FindSmallestIndexVersion added in v0.2.0

func (s SyncablesStore) FindSmallestIndexVersion() (*int64, error)

FindSmallestIndexVersion returns smallest index version

func (SyncablesStore) Save

func (s SyncablesStore) Save(record interface{}) error

Save saves record to database

func (SyncablesStore) SetProcessedAtForRange

func (s SyncablesStore) SetProcessedAtForRange(reportID types.ID, startHeight int64, endHeight int64) error

CreateOrUpdate creates a new syncable or updates an existing one

func (SyncablesStore) Truncate

func (s SyncablesStore) Truncate() error

Truncate removes all records from the table

func (SyncablesStore) Update

func (s SyncablesStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type ValidatorAggStore added in v0.1.2

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

ValidatorAgg handles operations on validators

func NewValidatorAggStore added in v0.1.2

func NewValidatorAggStore(db *gorm.DB) *ValidatorAggStore

func (ValidatorAggStore) All added in v0.1.2

All returns all validators

func (ValidatorAggStore) Create added in v0.1.2

func (s ValidatorAggStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (ValidatorAggStore) CreateOrUpdate added in v0.1.2

func (s ValidatorAggStore) CreateOrUpdate(val *model.ValidatorAgg) error

CreateOrUpdate creates a new validator or updates an existing one

func (ValidatorAggStore) DeleteByHeight added in v0.1.2

func (s ValidatorAggStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (ValidatorAggStore) FindBy added in v0.1.2

func (s ValidatorAggStore) FindBy(key string, value interface{}) (*model.ValidatorAgg, error)

FindBy returns an validator for a matching attribute

func (ValidatorAggStore) FindByID added in v0.1.2

func (s ValidatorAggStore) FindByID(id int64) (*model.ValidatorAgg, error)

FindByID returns an validator for the ID

func (*ValidatorAggStore) FindByStashAccount added in v0.1.2

func (s *ValidatorAggStore) FindByStashAccount(key string) (*model.ValidatorAgg, error)

FindByStashAccount return validator by stash account

func (*ValidatorAggStore) GetAllForHeightGreaterThan added in v0.1.2

func (s *ValidatorAggStore) GetAllForHeightGreaterThan(height int64) ([]model.ValidatorAgg, error)

GetAllForHeightGreaterThan returns validators who have been validating since given height

func (ValidatorAggStore) Save added in v0.1.2

func (s ValidatorAggStore) Save(record interface{}) error

Save saves record to database

func (ValidatorAggStore) Truncate added in v0.1.2

func (s ValidatorAggStore) Truncate() error

Truncate removes all records from the table

func (ValidatorAggStore) Update added in v0.1.2

func (s ValidatorAggStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type ValidatorEraSeqStore added in v0.1.2

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

ValidatorEraSeqStore handles operations on validators

func NewValidatorEraSeqStore added in v0.1.2

func NewValidatorEraSeqStore(db *gorm.DB) *ValidatorEraSeqStore

func (ValidatorEraSeqStore) Create added in v0.1.2

func (s ValidatorEraSeqStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (ValidatorEraSeqStore) CreateIfNotExists added in v0.1.2

func (s ValidatorEraSeqStore) CreateIfNotExists(validator *model.ValidatorEraSeq) error

CreateIfNotExists creates the validator if it does not exist

func (ValidatorEraSeqStore) DeleteByHeight added in v0.1.2

func (s ValidatorEraSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorEraSeqStore) DeleteOlderThan added in v0.1.2

func (s *ValidatorEraSeqStore) DeleteOlderThan(purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deletes validator sequence older than given threshold

func (ValidatorEraSeqStore) FindByEra added in v0.1.2

func (s ValidatorEraSeqStore) FindByEra(era int64) ([]model.ValidatorEraSeq, error)

FindByHeight finds validator era sequences by era

func (ValidatorEraSeqStore) FindByEraAndStashAccount added in v0.1.2

func (s ValidatorEraSeqStore) FindByEraAndStashAccount(era int64, stash string) (*model.ValidatorEraSeq, error)

FindByEraAndStashAccount finds validator by era and stash account

func (ValidatorEraSeqStore) FindByHeight added in v0.1.2

func (s ValidatorEraSeqStore) FindByHeight(h int64) ([]model.ValidatorEraSeq, error)

FindByHeight finds validator era sequences by height

func (ValidatorEraSeqStore) FindByHeightAndStashAccount added in v0.1.2

func (s ValidatorEraSeqStore) FindByHeightAndStashAccount(height int64, stash string) (*model.ValidatorEraSeq, error)

FindByHeightAndStashAccount finds validator by height and stash account

func (ValidatorEraSeqStore) FindLastByStashAccount added in v0.1.2

func (s ValidatorEraSeqStore) FindLastByStashAccount(stashAccount string, limit int64) ([]model.ValidatorEraSeq, error)

FindLastByStashAccount finds last validator era sequences for given stash account

func (*ValidatorEraSeqStore) FindMostRecent added in v0.1.2

func (s *ValidatorEraSeqStore) FindMostRecent() (*model.ValidatorEraSeq, error)

FindMostRecent finds most recent validator era sequence

func (ValidatorEraSeqStore) Save added in v0.1.2

func (s ValidatorEraSeqStore) Save(record interface{}) error

Save saves record to database

func (*ValidatorEraSeqStore) Summarize added in v0.1.2

func (s *ValidatorEraSeqStore) Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]ValidatorEraSeqSummary, error)

Summarize gets the summarized version of validator sequences

func (ValidatorEraSeqStore) Truncate added in v0.1.2

func (s ValidatorEraSeqStore) Truncate() error

Truncate removes all records from the table

func (ValidatorEraSeqStore) Update added in v0.1.2

func (s ValidatorEraSeqStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type ValidatorEraSeqSummary added in v0.1.2

type ValidatorEraSeqSummary struct {
	StashAccount    string         `json:"stash_account"`
	TimeBucket      types.Time     `json:"time_bucket"`
	TotalStakeAvg   types.Quantity `json:"total_stake_avg"`
	TotalStakeMin   types.Quantity `json:"total_stake_min"`
	TotalStakeMax   types.Quantity `json:"total_stake_max"`
	OwnStakeAvg     types.Quantity `json:"own_stake_avg"`
	OwnStakeMin     types.Quantity `json:"own_stake_min"`
	OwnStakeMax     types.Quantity `json:"own_stake_max"`
	StakersStakeAvg types.Quantity `json:"stakers_stake_avg"`
	StakersStakeMin types.Quantity `json:"stakers_stake_min"`
	StakersStakeMax types.Quantity `json:"stakers_stake_max"`
	RewardPointsAvg float64        `json:"reward_points_avg"`
	RewardPointsMin int64          `json:"reward_points_min"`
	RewardPointsMax int64          `json:"reward_points_max"`
	CommissionAvg   float64        `json:"commission_avg"`
	CommissionMin   int64          `json:"commission_min"`
	CommissionMax   int64          `json:"commission_max"`
	StakersCountAvg float64        `json:"stakers_count_avg"`
	StakersCountMin int64          `json:"stakers_count_min"`
	StakersCountMax int64          `json:"stakers_count_max"`
}

type ValidatorSessionSeqStore added in v0.1.2

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

ValidatorSessionSeqStore handles operations on validators

func NewValidatorSessionSeqStore added in v0.1.2

func NewValidatorSessionSeqStore(db *gorm.DB) *ValidatorSessionSeqStore

func (ValidatorSessionSeqStore) Create added in v0.1.2

func (s ValidatorSessionSeqStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (ValidatorSessionSeqStore) CreateIfNotExists added in v0.1.2

func (s ValidatorSessionSeqStore) CreateIfNotExists(validator *model.ValidatorSessionSeq) error

CreateIfNotExists creates the validator if it does not exist

func (ValidatorSessionSeqStore) DeleteByHeight added in v0.1.2

func (s ValidatorSessionSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSessionSeqStore) DeleteOlderThan added in v0.1.2

func (s *ValidatorSessionSeqStore) DeleteOlderThan(purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deletes validator sequence older than given threshold

func (ValidatorSessionSeqStore) FindByHeight added in v0.1.2

FindByHeight finds validator session sequences by height

func (ValidatorSessionSeqStore) FindByHeightAndStashAccount added in v0.1.2

func (s ValidatorSessionSeqStore) FindByHeightAndStashAccount(height int64, stash string) (*model.ValidatorSessionSeq, error)

FindByHeightAndStashAccount finds validator by height and stash account

func (ValidatorSessionSeqStore) FindBySession added in v0.1.2

func (s ValidatorSessionSeqStore) FindBySession(session int64) ([]model.ValidatorSessionSeq, error)

FindByHeight finds validator session sequences by session

func (ValidatorSessionSeqStore) FindBySessionAndStashAccount added in v0.1.2

func (s ValidatorSessionSeqStore) FindBySessionAndStashAccount(session int64, stash string) (*model.ValidatorSessionSeq, error)

FindBySessionAndStashAccount finds validator by session and stash account

func (ValidatorSessionSeqStore) FindLastByStashAccount added in v0.1.2

func (s ValidatorSessionSeqStore) FindLastByStashAccount(stashAccount string, limit int64) ([]model.ValidatorSessionSeq, error)

FindLastByStashAccount finds last validator session sequences for given stash account

func (*ValidatorSessionSeqStore) FindMostRecent added in v0.1.2

func (s *ValidatorSessionSeqStore) FindMostRecent() (*model.ValidatorSessionSeq, error)

FindMostRecent finds most recent validator session sequence

func (ValidatorSessionSeqStore) Save added in v0.1.2

func (s ValidatorSessionSeqStore) Save(record interface{}) error

Save saves record to database

func (*ValidatorSessionSeqStore) Summarize added in v0.1.2

Summarize gets the summarized version of validator sequences

func (ValidatorSessionSeqStore) Truncate added in v0.1.2

func (s ValidatorSessionSeqStore) Truncate() error

Truncate removes all records from the table

func (ValidatorSessionSeqStore) Update added in v0.1.2

func (s ValidatorSessionSeqStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

type ValidatorSessionSeqSummary added in v0.1.2

type ValidatorSessionSeqSummary struct {
	StashAccount string     `json:"stash_account"`
	TimeBucket   types.Time `json:"time_bucket"`
	UptimeAvg    float64    `json:"uptime_avg"`
	UptimeMin    int64      `json:"uptime_min"`
	UptimeMax    int64      `json:"uptime_max"`
}

type ValidatorSummaryRow added in v0.1.2

type ValidatorSummaryRow struct {
	TimeBucket      string         `json:"time_bucket"`
	TimeInterval    string         `json:"time_interval"`
	TotalStakeAvg   types.Quantity `json:"total_stake_avg"`
	TotalStakeMin   types.Quantity `json:"total_stake_min"`
	TotalStakeMax   types.Quantity `json:"total_stake_max"`
	OwnStakeAvg     types.Quantity `json:"own_stake_avg"`
	OwnStakeMin     types.Quantity `json:"own_stake_min"`
	OwnStakeMax     types.Quantity `json:"own_stake_max"`
	StakersStakeAvg types.Quantity `json:"stakers_stake_avg"`
	StakersStakeMin types.Quantity `json:"stakers_stake_min"`
	StakersStakeMax types.Quantity `json:"stakers_stake_max"`
	RewardPointsAvg float64        `json:"reward_points_avg"`
	RewardPointsMin int64          `json:"reward_points_min"`
	RewardPointsMax int64          `json:"reward_points_max"`
	CommissionAvg   float64        `json:"commission_avg"`
	CommissionMin   int64          `json:"commission_min"`
	CommissionMax   int64          `json:"commission_max"`
	StakersCountAvg float64        `json:"stakers_count_avg"`
	StakersCountMin int64          `json:"stakers_count_min"`
	StakersCountMax int64          `json:"stakers_count_max"`
}

type ValidatorSummaryStore added in v0.1.2

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

ValidatorSummaryStore handles operations on validators

func NewValidatorSummaryStore added in v0.1.2

func NewValidatorSummaryStore(db *gorm.DB) *ValidatorSummaryStore

func (ValidatorSummaryStore) Create added in v0.1.2

func (s ValidatorSummaryStore) Create(record interface{}) error

Create creates a new record. Must pass a pointer.

func (ValidatorSummaryStore) DeleteByHeight added in v0.1.2

func (s ValidatorSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSummaryStore) DeleteOlderThan added in v0.1.2

func (s *ValidatorSummaryStore) DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)

DeleteOlderThan deleted validator summary records older than given threshold

func (ValidatorSummaryStore) Find added in v0.1.2

Find find validator summary by query

func (*ValidatorSummaryStore) FindActivityPeriods added in v0.1.2

func (s *ValidatorSummaryStore) FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)

FindActivityPeriods Finds activity periods

func (*ValidatorSummaryStore) FindMostRecent added in v0.1.2

func (s *ValidatorSummaryStore) FindMostRecent() (*model.ValidatorSummary, error)

FindMostRecent finds most recent validator summary

func (*ValidatorSummaryStore) FindMostRecentByInterval added in v0.1.2

func (s *ValidatorSummaryStore) FindMostRecentByInterval(interval types.SummaryInterval) (*model.ValidatorSummary, error)

FindMostRecentByInterval finds most recent validator summary for interval

func (*ValidatorSummaryStore) FindSummary added in v0.1.2

func (s *ValidatorSummaryStore) FindSummary(interval types.SummaryInterval, period string) ([]ValidatorSummaryRow, error)

FindSummary gets summary for validator summary

func (*ValidatorSummaryStore) FindSummaryByStashAccount added in v0.1.2

func (s *ValidatorSummaryStore) FindSummaryByStashAccount(stashAccount string, interval types.SummaryInterval, period string) ([]model.ValidatorSummary, error)

FindSummaryByStashAccount gets summary for given validator

func (ValidatorSummaryStore) Save added in v0.1.2

func (s ValidatorSummaryStore) Save(record interface{}) error

Save saves record to database

func (ValidatorSummaryStore) Truncate added in v0.1.2

func (s ValidatorSummaryStore) Truncate() error

Truncate removes all records from the table

func (ValidatorSummaryStore) Update added in v0.1.2

func (s ValidatorSummaryStore) Update(record interface{}) error

Update updates the existing record. Must pass a pointer.

Jump to

Keyboard shortcuts

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