store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 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 AccountActivitySeqStore added in v0.1.0

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

AccountActivitySeqStore handles operations on account activities

func NewAccountActivitySeqStore added in v0.1.0

func NewAccountActivitySeqStore(db *gorm.DB) *AccountActivitySeqStore

func (AccountActivitySeqStore) Create added in v0.1.0

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

Create creates a new record. Must pass a pointer.

func (AccountActivitySeqStore) CreateIfNotExists added in v0.1.0

func (s AccountActivitySeqStore) CreateIfNotExists(accountActivity *model.AccountActivitySeq) error

CreateIfNotExists creates the account activity if it does not exist

func (AccountActivitySeqStore) DeleteByHeight added in v0.1.0

func (s AccountActivitySeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*AccountActivitySeqStore) DeleteForHeight added in v0.1.0

func (s *AccountActivitySeqStore) DeleteForHeight(h int64) (*int64, error)

DeleteForHeight deletes account activity sequence for given height

func (*AccountActivitySeqStore) DeleteOlderThan added in v0.1.0

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

DeleteOlderThan deletes account activity sequence older than given threshold

func (AccountActivitySeqStore) FindByHeight added in v0.1.0

FindByHeight finds account activity sequences by height

func (AccountActivitySeqStore) FindByHeightAndAddress added in v0.1.0

func (s AccountActivitySeqStore) FindByHeightAndAddress(height int64, address string) ([]model.AccountActivitySeq, error)

FindByHeightAndAddress finds account activities by height and address

func (AccountActivitySeqStore) FindLastByAddress added in v0.1.0

func (s AccountActivitySeqStore) FindLastByAddress(address string, limit int64) ([]model.AccountActivitySeq, error)

FindLastByAddress finds last account activity sequences for given address

func (AccountActivitySeqStore) FindLastByAddressAndKind added in v0.1.0

func (s AccountActivitySeqStore) FindLastByAddressAndKind(address string, kind string, limit int64) ([]model.AccountActivitySeq, error)

FindLastByAddressAndKind finds last account activity sequences for given address and kind

func (*AccountActivitySeqStore) FindMostRecent added in v0.1.0

func (s *AccountActivitySeqStore) FindMostRecent() (*model.AccountActivitySeq, error)

FindMostRecent finds most recent account activity sequence

func (AccountActivitySeqStore) Save added in v0.1.0

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

Save saves record to database

func (AccountActivitySeqStore) Truncate added in v0.1.0

func (s AccountActivitySeqStore) Truncate() error

Truncate removes all records from the table

func (AccountActivitySeqStore) Update added in v0.1.0

func (s AccountActivitySeqStore) 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 FindSystemEventByActorQuery added in v0.1.0

type FindSystemEventByActorQuery struct {
	Kind      *model.SystemEventKind
	MinHeight *int64
}

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

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

GovernanceActivitySeqStore handles operations on governance activities

func NewGovernanceActivitySeqStore added in v0.1.0

func NewGovernanceActivitySeqStore(db *gorm.DB) *GovernanceActivitySeqStore

func (GovernanceActivitySeqStore) Create added in v0.1.0

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

Create creates a new record. Must pass a pointer.

func (GovernanceActivitySeqStore) CreateIfNotExists added in v0.1.0

func (s GovernanceActivitySeqStore) CreateIfNotExists(governanceActivity *model.GovernanceActivitySeq) error

CreateIfNotExists creates the governance activity if it does not exist

func (GovernanceActivitySeqStore) DeleteByHeight added in v0.1.0

func (s GovernanceActivitySeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*GovernanceActivitySeqStore) DeleteForHeight added in v0.1.0

func (s *GovernanceActivitySeqStore) DeleteForHeight(h int64) (*int64, error)

DeleteForHeight deletes governance activity sequence for given height

func (*GovernanceActivitySeqStore) DeleteOlderThan added in v0.1.0

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

DeleteOlderThan deletes governance activity sequence older than given threshold

func (GovernanceActivitySeqStore) FindByHeight added in v0.1.0

FindByHeight finds governance activity sequences by height

func (GovernanceActivitySeqStore) FindByHeightAndProposalId added in v0.1.0

func (s GovernanceActivitySeqStore) FindByHeightAndProposalId(height int64, proposalId uint64) ([]model.GovernanceActivitySeq, error)

FindByHeightAndProposalId finds governance activities by height and proposal Id

func (GovernanceActivitySeqStore) FindByProposalId added in v0.1.0

func (s GovernanceActivitySeqStore) FindByProposalId(proposalId uint64, limit int64, cursor *int64) ([]model.GovernanceActivitySeq, *int64, error)

FindByProposalId finds governance activities by proposal Id

func (GovernanceActivitySeqStore) FindLastByProposalId added in v0.1.0

func (s GovernanceActivitySeqStore) FindLastByProposalId(proposalId uint64, limit int64) ([]model.GovernanceActivitySeq, error)

FindLastByProposalId finds last governance activity sequences for given proposal Id

func (GovernanceActivitySeqStore) FindLastByProposalIdAndKind added in v0.1.0

func (s GovernanceActivitySeqStore) FindLastByProposalIdAndKind(proposalId uint64, kind string, limit int64) ([]model.GovernanceActivitySeq, error)

FindLastByProposalIdAndKind finds last governance activity sequences for given proposal Id and kind

func (*GovernanceActivitySeqStore) FindMostRecent added in v0.1.0

FindMostRecent finds most recent governance activity sequence

func (GovernanceActivitySeqStore) Save added in v0.1.0

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

Save saves record to database

func (GovernanceActivitySeqStore) Truncate added in v0.1.0

func (s GovernanceActivitySeqStore) Truncate() error

Truncate removes all records from the table

func (GovernanceActivitySeqStore) Update added in v0.1.0

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

Update updates the existing record. Must pass a pointer.

type ProposalAggStore added in v0.1.0

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

ProposalAggStore handles operations on proposals

func NewProposalAggStore added in v0.1.0

func NewProposalAggStore(db *gorm.DB) *ProposalAggStore

func (ProposalAggStore) All added in v0.1.0

func (s ProposalAggStore) All(limit int64, cursor *int64) ([]model.ProposalAgg, *int64, error)

All returns all proposals

func (ProposalAggStore) Create added in v0.1.0

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

Create creates a new record. Must pass a pointer.

func (ProposalAggStore) CreateOrUpdate added in v0.1.0

func (s ProposalAggStore) CreateOrUpdate(val *model.ProposalAgg) error

CreateOrUpdate creates a new proposal or updates an existing one

func (ProposalAggStore) DeleteByHeight added in v0.1.0

func (s ProposalAggStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (ProposalAggStore) FindBy added in v0.1.0

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

FindBy returns an proposal for a matching attribute

func (ProposalAggStore) FindByID added in v0.1.0

func (s ProposalAggStore) FindByID(id int64) (*model.ProposalAgg, error)

FindByID returns an proposal for the ID

func (*ProposalAggStore) FindByProposalId added in v0.1.0

func (s *ProposalAggStore) FindByProposalId(proposalId uint64) (*model.ProposalAgg, error)

FindByProposalId return proposal by proposal Id

func (ProposalAggStore) Save added in v0.1.0

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

Save saves record to database

func (ProposalAggStore) Truncate added in v0.1.0

func (s ProposalAggStore) Truncate() error

Truncate removes all records from the table

func (ProposalAggStore) Update added in v0.1.0

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

Update updates the existing record. Must pass a pointer.

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

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
	ValidatorSeq          *ValidatorSeqStore
	ValidatorGroupSeq     *ValidatorGroupSeqStore
	AccountActivitySeq    *AccountActivitySeqStore
	GovernanceActivitySeq *GovernanceActivitySeqStore

	ValidatorAgg      *ValidatorAggStore
	ValidatorGroupAgg *ValidatorGroupAggStore
	ProposalAgg       *ProposalAggStore

	BlockSummary          *BlockSummaryStore
	ValidatorSummary      *ValidatorSummaryStore
	ValidatorGroupSummary *ValidatorGroupSummaryStore

	SystemEvents *SystemEventsStore
	// 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) FindLastInEpoch

func (s SyncablesStore) FindLastInEpoch(epoch int64) (syncable *model.Syncable, err error)

FindLastInEpoch finds last syncable in given epoch

func (SyncablesStore) FindLastInEpochForHeight

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

FindLastInEpochForHeight finds last_in_epoch syncable for given height

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

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

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

SystemEventsStore handles operations on syncables

func NewSystemEventsStore added in v0.1.0

func NewSystemEventsStore(db *gorm.DB) *SystemEventsStore

func (SystemEventsStore) Create added in v0.1.0

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

Create creates a new record. Must pass a pointer.

func (SystemEventsStore) CreateOrUpdate added in v0.1.0

func (s SystemEventsStore) CreateOrUpdate(val *model.SystemEvent) error

CreateOrUpdate creates a new system event or updates an existing one

func (SystemEventsStore) DeleteByHeight added in v0.1.0

func (s SystemEventsStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*SystemEventsStore) DeleteOlderThan added in v0.1.0

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

DeleteOlderThan deletes system events older than given threshold

func (SystemEventsStore) FindByActor added in v0.1.0

func (s SystemEventsStore) FindByActor(actorAddress string, query FindSystemEventByActorQuery) ([]model.SystemEvent, error)

FindByActor returns system events by actor

func (SystemEventsStore) FindByHeight added in v0.1.0

func (s SystemEventsStore) FindByHeight(height int64) ([]model.SystemEvent, error)

FindByHeight returns system events by height

func (*SystemEventsStore) FindMostRecent added in v0.1.0

func (s *SystemEventsStore) FindMostRecent() (*model.SystemEvent, error)

FindMostRecent finds most recent system event

func (SystemEventsStore) FindUnique added in v0.1.0

func (s SystemEventsStore) FindUnique(height int64, address string, kind model.SystemEventKind) (*model.SystemEvent, error)

FindUnique returns unique system

func (SystemEventsStore) Save added in v0.1.0

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

Save saves record to database

func (SystemEventsStore) Truncate added in v0.1.0

func (s SystemEventsStore) Truncate() error

Truncate removes all records from the table

func (SystemEventsStore) Update added in v0.1.0

func (s SystemEventsStore) 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

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

FindByAddress return validator by address

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 ValidatorGroupAggStore

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

ValidatorGroupAggStore handles operations on validators

func NewValidatorGroupAggStore

func NewValidatorGroupAggStore(db *gorm.DB) *ValidatorGroupAggStore

func (ValidatorGroupAggStore) All

All returns all validator groups

func (ValidatorGroupAggStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorGroupAggStore) CreateOrUpdate

func (s ValidatorGroupAggStore) CreateOrUpdate(val *model.ValidatorGroupAgg) error

CreateOrUpdate creates a new validator group or updates an existing one

func (ValidatorGroupAggStore) DeleteByHeight

func (s ValidatorGroupAggStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (ValidatorGroupAggStore) FindBy

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

FindBy returns an validator group for a matching attribute

func (*ValidatorGroupAggStore) FindByAddress

func (s *ValidatorGroupAggStore) FindByAddress(key string) (*model.ValidatorGroupAgg, error)

FindByAddress return validator group by address

func (ValidatorGroupAggStore) FindByID

FindByID returns an validator group for the ID

func (ValidatorGroupAggStore) Save

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

Save saves record to database

func (ValidatorGroupAggStore) Truncate

func (s ValidatorGroupAggStore) Truncate() error

Truncate removes all records from the table

func (ValidatorGroupAggStore) Update

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

Update updates the existing record. Must pass a pointer.

type ValidatorGroupSeqStore

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

ValidatorGroupSeqStore handles operations on validator groups

func NewValidatorGroupSeqStore

func NewValidatorGroupSeqStore(db *gorm.DB) *ValidatorGroupSeqStore

func (ValidatorGroupSeqStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorGroupSeqStore) CreateIfNotExists

func (s ValidatorGroupSeqStore) CreateIfNotExists(validator *model.ValidatorGroupSeq) error

CreateIfNotExists creates the validator group if it does not exist

func (ValidatorGroupSeqStore) DeleteByHeight

func (s ValidatorGroupSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorGroupSeqStore) DeleteOlderThan

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

DeleteOlderThan deletes validator group sequence older than given threshold

func (ValidatorGroupSeqStore) FindByHeight

func (s ValidatorGroupSeqStore) FindByHeight(h int64) ([]model.ValidatorGroupSeq, error)

FindByHeight finds validator group sequences by height

func (ValidatorGroupSeqStore) FindByHeightAndAddress

func (s ValidatorGroupSeqStore) FindByHeightAndAddress(height int64, address string) (*model.ValidatorGroupSeq, error)

FindByHeightAndAddress finds validator group by height and address

func (ValidatorGroupSeqStore) FindLastByAddress

func (s ValidatorGroupSeqStore) FindLastByAddress(address string, limit int64) ([]model.ValidatorGroupSeq, error)

FindLastByAddress finds last validator group sequences for given address

func (*ValidatorGroupSeqStore) FindMostRecent

func (s *ValidatorGroupSeqStore) FindMostRecent() (*model.ValidatorGroupSeq, error)

FindMostRecent finds most recent validator group sequence

func (ValidatorGroupSeqStore) Save

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

Save saves record to database

func (*ValidatorGroupSeqStore) Summarize

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

Summarize gets the summarized version of validator sequences

func (ValidatorGroupSeqStore) Truncate

func (s ValidatorGroupSeqStore) Truncate() error

Truncate removes all records from the table

func (ValidatorGroupSeqStore) Update

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

Update updates the existing record. Must pass a pointer.

type ValidatorGroupSeqSummary

type ValidatorGroupSeqSummary struct {
	Address            string         `json:"address"`
	TimeBucket         types.Time     `json:"time_bucket"`
	CommissionAvg      types.Quantity `json:"commission_avg"`
	CommissionMin      types.Quantity `json:"commission_min"`
	CommissionMax      types.Quantity `json:"commission_max"`
	ActiveVotesAvg     types.Quantity `json:"active_votes_avg"`
	ActiveVotesMin     types.Quantity `json:"active_votes_min"`
	ActiveVotesMax     types.Quantity `json:"active_votes_max"`
	ActiveVoteUnitsAvg types.Quantity `json:"active_vote_units_avg"`
	ActiveVoteUnitsMin types.Quantity `json:"active_vote_units_min"`
	ActiveVoteUnitsMax types.Quantity `json:"active_vote_units_max"`
	PendingVotesAvg    types.Quantity `json:"pending_votes_avg"`
	PendingVotesMin    types.Quantity `json:"pending_votes_min"`
	PendingVotesMax    types.Quantity `json:"pending_votes_max"`
}

type ValidatorGroupSummaryRow

type ValidatorGroupSummaryRow struct {
	TimeBucket         string `json:"time_bucket"`
	TimeInterval       string `json:"time_interval"`
	CommissionAvg      string `json:"commission_avg"`
	CommissionMin      string `json:"commission_min"`
	CommissionMax      string `json:"commission_max"`
	ActiveVotesAvg     string `json:"active_votes_avg"`
	ActiveVotesMin     string `json:"active_votes_min"`
	ActiveVotesMax     string `json:"active_votes_max"`
	ActiveVoteUnitsAvg string `json:"active_vote_units_avg"`
	ActiveVoteUnitsMin string `json:"active_vote_units_min"`
	ActiveVoteUnitsMax string `json:"active_vote_units_max"`
	PendingVotesAvg    string `json:"pending_votes_avg"`
	PendingVotesMin    string `json:"pending_votes_min"`
	PendingVotesMax    string `json:"pending_votes_max"`
}

type ValidatorGroupSummaryStore

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

ValidatorGroupSummaryStore handles operations on validator group summaries

func NewValidatorGroupSummaryStore

func NewValidatorGroupSummaryStore(db *gorm.DB) *ValidatorGroupSummaryStore

func (ValidatorGroupSummaryStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorGroupSummaryStore) DeleteByHeight

func (s ValidatorGroupSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorGroupSummaryStore) DeleteOlderThan

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

DeleteOlderThan deleted validator group summary records older than given threshold

func (ValidatorGroupSummaryStore) Find

Find find validator group summary by query

func (*ValidatorGroupSummaryStore) FindActivityPeriods

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

FindActivityPeriods Finds activity periods

func (*ValidatorGroupSummaryStore) FindMostRecent

FindMostRecent finds most recent validator group summary

func (*ValidatorGroupSummaryStore) FindMostRecentByInterval

func (s *ValidatorGroupSummaryStore) FindMostRecentByInterval(interval types.SummaryInterval) (*model.ValidatorGroupSummary, error)

FindMostRecentByInterval finds most recent validator group summary for interval

func (*ValidatorGroupSummaryStore) FindSummary

FindSummary gets summary for validator group summary

func (*ValidatorGroupSummaryStore) FindSummaryByAddress

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

FindSummaryByAddress gets summary for given validator group

func (ValidatorGroupSummaryStore) Save

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

Save saves record to database

func (ValidatorGroupSummaryStore) Truncate

func (s ValidatorGroupSummaryStore) Truncate() error

Truncate removes all records from the table

func (ValidatorGroupSummaryStore) Update

func (s ValidatorGroupSummaryStore) 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) DeleteByHeight

func (s ValidatorSeqStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSeqStore) DeleteOlderThan

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 sequences by height

func (ValidatorSeqStore) FindByHeightAndAddress

func (s ValidatorSeqStore) FindByHeightAndAddress(height int64, address string) (*model.ValidatorSeq, error)

FindByHeightAndAddress finds validator by height and address

func (ValidatorSeqStore) FindLastByAddress

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

FindLastByAddress finds last validator sequences for given address

func (*ValidatorSeqStore) FindMostRecent

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

FindMostRecent finds most recent validator era sequence

func (ValidatorSeqStore) Save

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

Save saves record to database

func (*ValidatorSeqStore) Summarize

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

type ValidatorSeqSummary struct {
	Address    string         `json:"address"`
	TimeBucket types.Time     `json:"time_bucket"`
	SignedAvg  float64        `json:"signed_avg"`
	SignedMin  int64          `json:"signed_min"`
	SignedMax  int64          `json:"signed_max"`
	ScoreAvg   types.Quantity `json:"score_avg"`
	ScoreMin   types.Quantity `json:"score_min"`
	ScoreMax   types.Quantity `json:"score_max"`
}

type ValidatorSummaryRow

type ValidatorSummaryRow struct {
	TimeBucket   string  `json:"time_bucket"`
	TimeInterval string  `json:"time_interval"`
	SignedAvg    float64 `json:"signed_avg"`
	ScoreAvg     string  `json:"score_avg"`
	ScoreMin     string  `json:"score_min"`
	ScoreMax     string  `json:"score_max"`
}

type ValidatorSummaryStore

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

ValidatorSummaryStore handles operations on validators

func NewValidatorSummaryStore

func NewValidatorSummaryStore(db *gorm.DB) *ValidatorSummaryStore

func (ValidatorSummaryStore) Create

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

Create creates a new record. Must pass a pointer.

func (ValidatorSummaryStore) DeleteByHeight

func (s ValidatorSummaryStore) DeleteByHeight(height int64) error

DeleteByHeight removes all records associated with a height

func (*ValidatorSummaryStore) DeleteOlderThan

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

DeleteOlderThan deleted validator summary records older than given threshold

func (ValidatorSummaryStore) Find

Find find validator summary by query

func (*ValidatorSummaryStore) FindActivityPeriods

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

FindActivityPeriods Finds activity periods

func (*ValidatorSummaryStore) FindMostRecent

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

FindMostRecent finds most recent validator summary

func (*ValidatorSummaryStore) FindMostRecentByInterval

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

FindMostRecentByInterval finds most recent validator summary for interval

func (*ValidatorSummaryStore) FindSummary

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

FindSummary gets summary for validator summary

func (*ValidatorSummaryStore) FindSummaryByAddress

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

FindSummaryByAddress gets summary for given validator

func (ValidatorSummaryStore) Save

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

Save saves record to database

func (ValidatorSummaryStore) Truncate

func (s ValidatorSummaryStore) Truncate() error

Truncate removes all records from the table

func (ValidatorSummaryStore) Update

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