store

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 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 AccountAggStore

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

AccountAggStore handles operations on accounts

func NewAccountAggStore

func NewAccountAggStore(db *gorm.DB) *AccountAggStore

func (AccountAggStore) All

func (s AccountAggStore) All() ([]model.AccountAgg, error)

All returns all accounts

func (AccountAggStore) Create

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

Create creates a new record. Must pass a pointer.

func (AccountAggStore) CreateOrUpdate

func (s AccountAggStore) CreateOrUpdate(acc *model.AccountAgg) error

CreateOrUpdate creates a new account or updates an existing one

func (AccountAggStore) DeleteByHeight

func (s AccountAggStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (AccountAggStore) FindBy

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

FindBy returns an account for a matching attribute

func (AccountAggStore) FindByID

func (s AccountAggStore) FindByID(id int64) (*model.AccountAgg, error)

FindByID returns an account for the ID

func (AccountAggStore) FindByPublicKey

func (s AccountAggStore) FindByPublicKey(key string) (*model.AccountAgg, error)

FindByPublicKey returns an account for the public key

func (AccountAggStore) Save

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

Save saves record to database

func (AccountAggStore) Truncate

func (s AccountAggStore) Truncate() error

Truncate removes all records from the table

func (AccountAggStore) Update

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

Update updates the existing record. Must pass a pointer.

type ActivityPeriodRow added in v0.4.2

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

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

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

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

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

type BlockSummaryStore added in v0.4.0

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

BlockSummaryStore handles operations on block summary

func NewBlockSummaryStore added in v0.4.0

func NewBlockSummaryStore(db *gorm.DB) *BlockSummaryStore

func (BlockSummaryStore) Create added in v0.4.0

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

Create creates a new record. Must pass a pointer.

func (BlockSummaryStore) DeleteByHeight added in v0.4.0

func (s BlockSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*BlockSummaryStore) DeleteOlderThan added in v0.4.0

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

DeleteOlderThan deletes block summary records older than given threshold

func (BlockSummaryStore) Find added in v0.4.0

Find find block summary by query

func (*BlockSummaryStore) FindActivityPeriods added in v0.4.2

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

FindActivityPeriods Finds activity periods

func (*BlockSummaryStore) FindMostRecent added in v0.4.0

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

FindMostRecent finds most recent block summary

func (*BlockSummaryStore) FindMostRecentByInterval added in v0.4.0

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

FindMostRecentByInterval finds most recent block summary for given time interval

func (*BlockSummaryStore) FindSummary added in v0.4.0

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

FindSummary Gets summary of block sequences

func (BlockSummaryStore) Save added in v0.4.0

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

Save saves record to database

func (BlockSummaryStore) Truncate added in v0.4.0

func (s BlockSummaryStore) Truncate() error

Truncate removes all records from the table

func (BlockSummaryStore) Update added in v0.4.0

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

Update updates the existing record. Must pass a pointer.

type DatabaseStore added in v0.4.0

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

DatabaseStore handles operations on blocks

func NewDatabaseStore added in v0.4.0

func NewDatabaseStore(db *gorm.DB) *DatabaseStore

func (*DatabaseStore) GetTotalSize added in v0.4.0

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

FindSummary Gets average block times for interval

type DebondingDelegationSeqStore

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

DebondingDelegationSeqStore handles operations on debondingDelegations

func NewDebondingDelegationSeqStore

func NewDebondingDelegationSeqStore(db *gorm.DB) *DebondingDelegationSeqStore

func (DebondingDelegationSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (DebondingDelegationSeqStore) CreateIfNotExists

func (s DebondingDelegationSeqStore) CreateIfNotExists(debondingDelegation *model.DebondingDelegationSeq) error

CreateIfNotExists creates the debondingDelegation if it does not exist

func (DebondingDelegationSeqStore) DeleteByHeight

func (s DebondingDelegationSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (DebondingDelegationSeqStore) FindByHeight

FindByHeight finds debonding delegations by height

func (*DebondingDelegationSeqStore) FindRecentByDelegatorUID

func (s *DebondingDelegationSeqStore) FindRecentByDelegatorUID(key string, limit int64) ([]model.DebondingDelegationSeq, error)

FindRecentByDelegatorUID gets recent debonding delegations for delegator

func (*DebondingDelegationSeqStore) FindRecentByValidatorUID

func (s *DebondingDelegationSeqStore) FindRecentByValidatorUID(key string, limit int64) ([]model.DebondingDelegationSeq, error)

FindRecentByValidatorUID gets recent debonding delegations for validator

func (DebondingDelegationSeqStore) Save

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

Save saves record to database

func (DebondingDelegationSeqStore) Truncate

func (s DebondingDelegationSeqStore) Truncate() error

Truncate removes all records from the table

func (DebondingDelegationSeqStore) Update

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

Update updates the existing record. Must pass a pointer.

type DelegationSeqStore

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

DelegationSeqStore handles operations on delegations

func NewDelegationSeqStore

func NewDelegationSeqStore(db *gorm.DB) *DelegationSeqStore

func (DelegationSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (DelegationSeqStore) CreateIfNotExists

func (s DelegationSeqStore) CreateIfNotExists(delegation *model.DelegationSeq) error

CreateIfNotExists creates the delegation if it does not exist

func (DelegationSeqStore) DeleteByHeight

func (s DelegationSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (DelegationSeqStore) FindByHeight

func (s DelegationSeqStore) FindByHeight(h int64) ([]model.DelegationSeq, error)

FindByHeight finds delegation by height

func (*DelegationSeqStore) FindCurrentByDelegatorUID

func (s *DelegationSeqStore) FindCurrentByDelegatorUID(key string) ([]model.DelegationSeq, error)

GetCurrentByDelegatorUID gets current delegations for delegator

func (*DelegationSeqStore) FindLastByValidatorUID

func (s *DelegationSeqStore) FindLastByValidatorUID(key string) ([]model.DelegationSeq, error)

GetLastByValidatorUID finds last delegations for validator

func (DelegationSeqStore) Save

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

Save saves record to database

func (DelegationSeqStore) Truncate

func (s DelegationSeqStore) Truncate() error

Truncate removes all records from the table

func (DelegationSeqStore) Update

func (s DelegationSeqStore) 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 added in v0.4.0

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) DeleteReindexing added in v0.4.2

func (s *ReportsStore) DeleteReindexing() error

DeleteReindexing deletes reports with kind reindexing sequential or parallel

func (ReportsStore) FindNotCompletedByIndexVersion added in v0.4.2

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

FindNotCompletedByIndexVersion returns the report by index version and kind

func (ReportsStore) FindNotCompletedByKind added in v0.4.2

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 StakingSeqStore

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

StakingSeqStore handles operations on staking

func NewStakingSeqStore

func NewStakingSeqStore(db *gorm.DB) *StakingSeqStore

func (StakingSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (StakingSeqStore) CreateIfNotExists

func (s StakingSeqStore) CreateIfNotExists(staking *model.StakingSeq) error

CreateIfNotExists creates the staking if it does not exist

func (StakingSeqStore) DeleteByHeight

func (s StakingSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (StakingSeqStore) FindBy

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

FindBy returns a staking for a matching attribute

func (StakingSeqStore) FindByHeight

func (s StakingSeqStore) FindByHeight(height int64) (*model.StakingSeq, error)

FindByHeight returns a staking with the matching height

func (StakingSeqStore) FindByID

func (s StakingSeqStore) FindByID(id int64) (*model.StakingSeq, error)

FindByID returns a staking with matching ID

func (StakingSeqStore) Recent

func (s StakingSeqStore) Recent() (*model.StakingSeq, error)

Recent returns the most recent staking

func (StakingSeqStore) Save

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

Save saves record to database

func (StakingSeqStore) Truncate

func (s StakingSeqStore) Truncate() error

Truncate removes all records from the table

func (StakingSeqStore) Update

func (s StakingSeqStore) 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
	DebondingDelegationSeq *DebondingDelegationSeqStore
	DelegationSeq          *DelegationSeqStore
	StakingSeq             *StakingSeqStore
	TransactionSeq         *TransactionSeqStore
	ValidatorSeq           *ValidatorSeqStore

	ValidatorSummary *ValidatorSummaryStore
	BlockSummary     *BlockSummaryStore

	AccountAgg   *AccountAggStore
	ValidatorAgg *ValidatorAggStore
	// 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 added in v0.4.2

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

FindFirstByDifferentIndexVersion returns first syncable with different index version

func (SyncablesStore) FindMostRecent

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

FindMostRecent returns the most recent syncable

func (SyncablesStore) FindMostRecentByDifferentIndexVersion added in v0.4.2

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

FindMostRecentByDifferentIndexVersion returns the most recent syncable with different index version

func (SyncablesStore) Save

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

Save saves record to database

func (SyncablesStore) SetProcessedAtForRange added in v0.4.2

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 TransactionSeqStore

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

TransactionSeqStore handles operations on transactions

func NewTransactionSeqStore

func NewTransactionSeqStore(db *gorm.DB) *TransactionSeqStore

func (TransactionSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (TransactionSeqStore) CreateIfNotExists

func (s TransactionSeqStore) CreateIfNotExists(transaction *model.TransactionSeq) error

CreateIfNotExists creates the transaction if it does not exist

func (TransactionSeqStore) DeleteByHeight

func (s TransactionSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (TransactionSeqStore) FindByHeight

func (s TransactionSeqStore) FindByHeight(h int64) ([]model.TransactionSeq, error)

func (TransactionSeqStore) Save

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

Save saves record to database

func (TransactionSeqStore) Truncate

func (s TransactionSeqStore) Truncate() error

Truncate removes all records from the table

func (TransactionSeqStore) Update

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

Update updates the existing record. Must pass a pointer.

type ValidatorAggStore

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

ValidatorAggStore handles operations on validators

func NewValidatorAggStore

func NewValidatorAggStore(db *gorm.DB) *ValidatorAggStore

func (ValidatorAggStore) All

All returns all validators

func (ValidatorAggStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorAggStore) CreateOrUpdate

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

CreateOrUpdate creates a new validator or updates an existing one

func (ValidatorAggStore) DeleteByHeight

func (s ValidatorAggStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (ValidatorAggStore) FindBy

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

FindBy returns an validator for a matching attribute

func (*ValidatorAggStore) FindByAddress added in v0.4.2

func (s *ValidatorAggStore) FindByAddress(address string) (*model.ValidatorAgg, error)

FindByAddress return validator by entity UID

func (*ValidatorAggStore) FindByEntityUID

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

FindByEntityUID return validator by entity UID

func (ValidatorAggStore) FindByID

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

FindByID returns an validator for the ID

func (*ValidatorAggStore) GetAllForHeightGreaterThan

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

GetAllForHeightGreaterThan returns validators who have been validating since given height

func (ValidatorAggStore) Save

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

Save saves record to database

func (ValidatorAggStore) Truncate

func (s ValidatorAggStore) Truncate() error

Truncate removes all records from the table

func (ValidatorAggStore) Update

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

Update updates the existing record. Must pass a pointer.

type ValidatorSeqStore

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

ValidatorSeqStore handles operations on validators

func NewValidatorSeqStore

func NewValidatorSeqStore(db *gorm.DB) *ValidatorSeqStore

func (ValidatorSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorSeqStore) CreateIfNotExists

func (s ValidatorSeqStore) CreateIfNotExists(validator *model.ValidatorSeq) error

CreateIfNotExists creates the validator if it does not exist

func (ValidatorSeqStore) CreateOrUpdate added in v0.4.2

func (s ValidatorSeqStore) CreateOrUpdate(val *model.ValidatorSeq) error

TODO: FIX CreateOrUpdate creates a new validator sequence or updates an existing one

func (ValidatorSeqStore) DeleteByHeight

func (s ValidatorSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSeqStore) DeleteOlderThan added in v0.4.0

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

DeleteOlderThan deletes validator sequence older than given threshold

func (ValidatorSeqStore) FindByHeight

func (s ValidatorSeqStore) FindByHeight(h int64) ([]model.ValidatorSeq, error)

FindByHeight finds validator by height

func (ValidatorSeqStore) FindByHeightAndEntityUID added in v0.4.2

func (s ValidatorSeqStore) FindByHeightAndEntityUID(h int64, key string) (*model.ValidatorSeq, error)

FindByHeight finds validator by height

func (ValidatorSeqStore) FindLastByAddress added in v0.4.2

func (s ValidatorSeqStore) FindLastByAddress(address string, limit int64) ([]model.ValidatorSeq, error)

FindLastByAddress finds last validator sequences for given entity uid

func (*ValidatorSeqStore) FindMostRecent added in v0.4.0

func (s *ValidatorSeqStore) FindMostRecent() (*model.ValidatorSeq, error)

FindMostRecent finds most recent validator sequence

func (ValidatorSeqStore) Save

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

Save saves record to database

func (*ValidatorSeqStore) Summarize added in v0.4.0

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

Summarize gets the summarized version of validator sequences

func (ValidatorSeqStore) Truncate

func (s ValidatorSeqStore) Truncate() error

Truncate removes all records from the table

func (ValidatorSeqStore) Update

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

Update updates the existing record. Must pass a pointer.

type ValidatorSeqSummary added in v0.4.0

type ValidatorSeqSummary struct {
	Address         string         `json:"address"`
	TimeBucket      types.Time     `json:"time_bucket"`
	VotingPowerAvg  float64        `json:"voting_power_avg"`
	VotingPowerMax  float64        `json:"voting_power_max"`
	VotingPowerMin  float64        `json:"voting_power_min"`
	TotalSharesAvg  types.Quantity `json:"total_shares_avg"`
	TotalSharesMax  types.Quantity `json:"total_shares_max"`
	TotalSharesMin  types.Quantity `json:"total_shares_min"`
	ValidatedSum    int64          `json:"validated_sum"`
	NotValidatedSum int64          `json:"not_validated_sum"`
	ProposedSum     int64          `json:"proposed_sum"`
	UptimeAvg       float64        `json:"uptime_avg"`
}

type ValidatorSummaryRow added in v0.4.0

type ValidatorSummaryRow struct {
	TimeBucket      string         `json:"time_bucket"`
	TimeInterval    string         `json:"time_interval"`
	VotingPowerAvg  float64        `json:"voting_power_avg"`
	VotingPowerMax  float64        `json:"voting_power_max"`
	VotingPowerMin  float64        `json:"voting_power_min"`
	TotalSharesAvg  types.Quantity `json:"total_shares_avg"`
	TotalSharesMax  types.Quantity `json:"total_shares_max"`
	TotalSharesMin  types.Quantity `json:"total_shares_min"`
	ValidatedSum    int64          `json:"validated_sum"`
	NotValidatedSum int64          `json:"not_validated_sum"`
	ProposedSum     int64          `json:"proposed_sum"`
	UptimeAvg       float64        `json:"uptime_avg"`
}

type ValidatorSummaryStore added in v0.4.0

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

ValidatorSummaryStore handles operations on validators

func NewValidatorSummaryStore added in v0.4.0

func NewValidatorSummaryStore(db *gorm.DB) *ValidatorSummaryStore

func (ValidatorSummaryStore) Create added in v0.4.0

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

Create creates a new record. Must pass a pointer.

func (ValidatorSummaryStore) DeleteByHeight added in v0.4.0

func (s ValidatorSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSummaryStore) DeleteOlderThan added in v0.4.0

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.4.0

Find find validator summary by query

func (*ValidatorSummaryStore) FindActivityPeriods added in v0.4.2

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

FindActivityPeriods Finds activity periods

func (*ValidatorSummaryStore) FindMostRecent added in v0.4.0

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

FindMostRecent finds most recent validator summary

func (*ValidatorSummaryStore) FindMostRecentByInterval added in v0.4.0

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

FindMostRecentByInterval finds most recent validator summary for interval

func (*ValidatorSummaryStore) FindSummary added in v0.4.0

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

FindSummary gets summary for validator summary

func (*ValidatorSummaryStore) FindSummaryByAddress added in v0.4.2

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

FindSummaryByAddress gets summary for given validator

func (ValidatorSummaryStore) Save added in v0.4.0

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

Save saves record to database

func (ValidatorSummaryStore) Truncate added in v0.4.0

func (s ValidatorSummaryStore) Truncate() error

Truncate removes all records from the table

func (ValidatorSummaryStore) Update added in v0.4.0

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