Documentation ¶
Index ¶
- Variables
- type ActivityPeriodRow
- type BlockSeqStore
- func (s BlockSeqStore) Create(record interface{}) error
- func (s BlockSeqStore) CreateIfNotExists(block *model.BlockSeq) error
- func (s BlockSeqStore) DeleteByHeight(height int64) error
- func (s *BlockSeqStore) DeleteOlderThan(purgeThreshold time.Time, activityPeriods []ActivityPeriodRow) (*int64, error)
- func (s BlockSeqStore) FindBy(key string, value interface{}) (*model.BlockSeq, error)
- func (s BlockSeqStore) FindByHeight(height int64) (*model.BlockSeq, error)
- func (s BlockSeqStore) FindByID(id int64) (*model.BlockSeq, error)
- func (s *BlockSeqStore) FindMostRecent() (*model.BlockSeq, error)
- func (s *BlockSeqStore) GetAvgRecentTimes(limit int64) GetAvgRecentTimesResult
- func (s BlockSeqStore) Save(record interface{}) error
- func (s *BlockSeqStore) Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]BlockSeqSummary, error)
- func (s BlockSeqStore) Truncate() error
- func (s BlockSeqStore) Update(record interface{}) error
- type BlockSeqSummary
- type BlockSummaryStore
- func (s BlockSummaryStore) Create(record interface{}) error
- func (s BlockSummaryStore) DeleteByHeight(height int64) error
- func (s *BlockSummaryStore) DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)
- func (s BlockSummaryStore) Find(query *model.BlockSummary) (*model.BlockSummary, error)
- func (s *BlockSummaryStore) FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)
- func (s *BlockSummaryStore) FindMostRecent() (*model.BlockSummary, error)
- func (s *BlockSummaryStore) FindMostRecentByInterval(interval types.SummaryInterval) (*model.BlockSummary, error)
- func (s *BlockSummaryStore) FindSummary(interval types.SummaryInterval, period string) ([]model.BlockSummary, error)
- func (s BlockSummaryStore) Save(record interface{}) error
- func (s BlockSummaryStore) Truncate() error
- func (s BlockSummaryStore) Update(record interface{}) error
- type DatabaseStore
- type GetAvgRecentTimesResult
- type GetAvgTimesForIntervalRow
- type GetTotalSizeResult
- type ReportsStore
- func (s ReportsStore) Create(record interface{}) error
- func (s ReportsStore) DeleteByHeight(height int64) error
- func (s *ReportsStore) DeleteReindexing() error
- func (s ReportsStore) FindNotCompletedByIndexVersion(indexVersion int64, kinds ...model.ReportKind) (*model.Report, error)
- func (s ReportsStore) FindNotCompletedByKind(kinds ...model.ReportKind) (*model.Report, error)
- func (s ReportsStore) Last() (*model.Report, error)
- func (s ReportsStore) Save(record interface{}) error
- func (s ReportsStore) Truncate() error
- func (s ReportsStore) Update(record interface{}) error
- type Store
- type SyncablesStore
- func (s SyncablesStore) Create(record interface{}) error
- func (s SyncablesStore) CreateOrUpdate(val *model.Syncable) error
- func (s SyncablesStore) DeleteByHeight(height int64) error
- func (s SyncablesStore) FindByHeight(height int64) (syncable *model.Syncable, err error)
- func (s SyncablesStore) FindFirstByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
- func (s SyncablesStore) FindMostRecent() (*model.Syncable, error)
- func (s SyncablesStore) FindMostRecentByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
- func (s SyncablesStore) Save(record interface{}) error
- func (s SyncablesStore) SetProcessedAtForRange(reportID types.ID, startHeight int64, endHeight int64) error
- func (s SyncablesStore) Truncate() error
- func (s SyncablesStore) Update(record interface{}) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("record not found")
)
Functions ¶
This section is empty.
Types ¶
type ActivityPeriodRow ¶
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 ¶
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
type BlockSeqSummary ¶
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 ¶
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 ¶
func (s BlockSummaryStore) Find(query *model.BlockSummary) (*model.BlockSummary, error)
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
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 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 ¶
DeleteByHeight removes all records associated with a height
func (*ReportsStore) DeleteReindexing ¶
func (s *ReportsStore) DeleteReindexing() error
DeleteReindexing 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
type Store ¶
type Store struct { Database *DatabaseStore Syncables *SyncablesStore Reports *ReportsStore BlockSeq *BlockSeqStore BlockSummary *BlockSummaryStore // contains filtered or unexported fields }
Store handles all database operations
func (*Store) SetDebugMode ¶
SetDebugMode enabled detailed query logging
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 ¶
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) 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) 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