store

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountActivitySeq added in v0.1.6

type AccountActivitySeq interface {
	BulkUpsert(records []model.AccountActivitySeq) error
	FindByHeightAndAddress(height int64, address string) ([]model.AccountActivitySeq, error)
	FindByHeight(h int64) ([]model.AccountActivitySeq, error)
	FindMostRecent() (*model.AccountActivitySeq, error)
	FindLastByAddress(address string, limit int64) ([]model.AccountActivitySeq, error)
	FindLastByAddressAndKind(address string, kind []string, limit int64) ([]model.AccountActivitySeq, error)
	DeleteOlderThan(purgeThreshold time.Time) (*int64, error)
	DeleteForHeight(h int64) (*int64, error)
}

type ActivityPeriodRow

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

type BaseStore added in v0.1.6

type BaseStore interface {
	Create(record interface{}) error
	Update(record interface{}) error
	Save(record interface{}) error
}

type BlockSeq added in v0.1.6

type BlockSeq interface {
	Create(block *model.BlockSeq) error
	Save(block *model.BlockSeq) error
	CreateIfNotExists(block *model.BlockSeq) error
	FindBy(key string, value interface{}) (*model.BlockSeq, error)
	FindByID(id int64) (*model.BlockSeq, error)
	FindByHeight(height int64) (*model.BlockSeq, error)
	GetAvgRecentTimes(limit int64) GetAvgRecentTimesResult
	FindMostRecent() (*model.BlockSeq, error)
	DeleteOlderThan(purgeThreshold time.Time, activityPeriods []ActivityPeriodRow) (*int64, error)
	Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]BlockSeqSummary, error)
}

type BlockSeqSummary

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

type BlockSummary added in v0.1.6

type BlockSummary interface {
	Find(query *model.BlockSummary) (*model.BlockSummary, error)
	FindMostRecent() (*model.BlockSummary, error)
	FindMostRecentByInterval(interval types.SummaryInterval) (*model.BlockSummary, error)
	FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)
	FindSummary(interval types.SummaryInterval, period string) ([]model.BlockSummary, error)
	DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)
}

type Database added in v0.1.6

type Database interface {
	GetTotalSize() (*GetTotalSizeResult, error)
}

type FindAll added in v0.2.0

type FindAll struct {
	Page  uint
	Limit uint
}

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 GetTotalSizeResult

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

GetAvgTimesForIntervalRow Contains row of data for FindSummary query

type GovernanceActivitySeq added in v0.1.6

type GovernanceActivitySeq interface {
	BulkUpsert(records []model.GovernanceActivitySeq) error
	CreateIfNotExists(governanceActivity *model.GovernanceActivitySeq) error
	FindByHeightAndProposalId(height int64, proposalId uint64) ([]model.GovernanceActivitySeq, error)
	FindByHeight(h int64) ([]model.GovernanceActivitySeq, error)
	FindByProposalId(proposalId uint64, limit int64, cursor *int64) ([]model.GovernanceActivitySeq, *int64, error)
	FindMostRecent() (*model.GovernanceActivitySeq, error)
	FindLastByProposalId(proposalId uint64, limit int64) ([]model.GovernanceActivitySeq, error)
	FindLastByProposalIdAndKind(proposalId uint64, kind string, limit int64) ([]model.GovernanceActivitySeq, error)
	DeleteOlderThan(purgeThreshold time.Time) (*int64, error)
	DeleteForHeight(h int64) (*int64, error)
}

type Jobs added in v0.2.0

type Jobs interface {
	Create(jobs []model.Job) error
	Update(job *model.Job, fields ...string) error
	FindByHeight(height int64) (*model.Job, error)
	FindAllUnfinished() ([]model.Job, error)
	LastFinishedHeight() (int64, error)
	LastSyncedHeight() (int64, error)
}

type PaginatedResult added in v0.3.0

type PaginatedResult struct {
	Page    uint        `json:"page"`
	Pages   uint        `json:"pages"`
	Limit   uint        `json:"limit"`
	Count   uint        `json:"count"`
	Records interface{} `json:"records"`
}

func (*PaginatedResult) Update added in v0.3.0

func (p *PaginatedResult) Update() *PaginatedResult

Update recalculates the total number of pages based on record count

type Pagination added in v0.3.0

type Pagination struct {
	Page  uint `form:"page"`
	Limit uint `form:"limit"`
}

func (*Pagination) Validate added in v0.3.0

func (p *Pagination) Validate() error

type ProposalAgg added in v0.1.6

type ProposalAgg interface {
	Create(*model.ProposalAgg) error
	Save(*model.ProposalAgg) error
	CreateOrUpdate(val *model.ProposalAgg) error
	FindBy(key string, value interface{}) (*model.ProposalAgg, error)
	FindByID(id int64) (*model.ProposalAgg, error)
	FindByProposalId(proposalId uint64) (*model.ProposalAgg, error)
	All(limit int64, cursor *int64) ([]model.ProposalAgg, *int64, error)
}

type Reports added in v0.1.6

type Reports interface {
	Create(report *model.Report) error
	Save(report *model.Report) error
	FindNotCompletedByIndexVersion(indexVersion int64, kinds ...model.ReportKind) (*model.Report, error)
	FindNotCompletedByKind(kinds ...model.ReportKind) (*model.Report, error)
	Last() (*model.Report, error)
	DeleteByKinds(kinds []model.ReportKind) error
}

type Syncables added in v0.1.6

type Syncables interface {
	Save(syncable *model.Syncable) error
	FindSmallestIndexVersion() (*int64, error)
	FindByHeight(height int64) (syncable *model.Syncable, err error)
	FindMostRecent() (*model.Syncable, error)
	FindMostRecentProcessed() (*model.Syncable, error)
	FindLastInEpochForHeight(height int64) (syncable *model.Syncable, err error)
	FindLastInEpoch(epoch int64) (syncable *model.Syncable, err error)
	FindFirstByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
	FindMostRecentByDifferentIndexVersion(indexVersion int64) (*model.Syncable, error)
	CreateOrUpdate(val *model.Syncable) error
	SetProcessedAtForRange(reportID types.ID, startHeight int64, endHeight int64) error
}

type SystemEvents added in v0.1.6

type SystemEvents interface {
	BulkUpsert(records []model.SystemEvent) error
	FindByHeight(height int64) ([]model.SystemEvent, error)
	FindByActor(actorAddress string, query FindSystemEventByActorQuery) ([]model.SystemEvent, error)
	FindAll(query FindAll) (*PaginatedResult, error)
	FindUnique(height int64, address string, kind model.SystemEventKind) (*model.SystemEvent, error)
	FindMostRecent() (*model.SystemEvent, error)
	DeleteOlderThan(purgeThreshold time.Time) (*int64, error)
}

type ValidatorAgg added in v0.1.6

type ValidatorAgg interface {
	BulkUpsert([]model.ValidatorAgg) error
	UpdateIdentity(*model.ValidatorAgg) error
	FindBy(key string, value interface{}) (*model.ValidatorAgg, error)
	FindByID(id int64) (*model.ValidatorAgg, error)
	FindByAddress(key string) (*model.ValidatorAgg, error)
	GetAllForHeightGreaterThan(height int64) ([]model.ValidatorAgg, error)
	All() ([]model.ValidatorAgg, error)
}

type ValidatorGroupAgg added in v0.1.6

type ValidatorGroupAgg interface {
	BulkUpsert([]model.ValidatorGroupAgg) error
	UpdateIdentity(*model.ValidatorGroupAgg) error
	FindBy(key string, value interface{}) (*model.ValidatorGroupAgg, error)
	FindByID(id int64) (*model.ValidatorGroupAgg, error)
	FindByAddress(key string) (*model.ValidatorGroupAgg, error)
	All() ([]model.ValidatorGroupAgg, error)
}

type ValidatorGroupSeq added in v0.1.6

type ValidatorGroupSeq interface {
	BulkUpsert(records []model.ValidatorGroupSeq) error
	FindByHeightAndAddress(height int64, address string) (*model.ValidatorGroupSeq, error)
	FindByHeight(h int64) ([]model.ValidatorGroupSeq, error)
	FindLastByAddress(address string, limit int64) ([]model.ValidatorGroupSeq, error)
	FindMostRecent() (*model.ValidatorGroupSeq, error)
	DeleteOlderThan(purgeThreshold time.Time) (*int64, error)
	Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]ValidatorGroupSeqSummary, error)
}

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"`
	PendingVotesAvg types.Quantity `json:"pending_votes_avg"`
	PendingVotesMin types.Quantity `json:"pending_votes_min"`
	PendingVotesMax types.Quantity `json:"pending_votes_max"`
}

type ValidatorGroupSummary added in v0.1.6

type ValidatorGroupSummary interface {
	BulkUpsert(records []model.ValidatorGroupSummary) error
	Find(query *model.ValidatorGroupSummary) (*model.ValidatorGroupSummary, error)
	FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)
	FindSummary(interval types.SummaryInterval, period string) ([]ValidatorGroupSummaryRow, error)
	FindSummaryByAddress(address string, interval types.SummaryInterval, period string) ([]model.ValidatorGroupSummary, error)
	FindMostRecent() (*model.ValidatorGroupSummary, error)
	FindMostRecentByInterval(interval types.SummaryInterval) (*model.ValidatorGroupSummary, error)
	DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)
}

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"`
	PendingVotesAvg string `json:"pending_votes_avg"`
	PendingVotesMin string `json:"pending_votes_min"`
	PendingVotesMax string `json:"pending_votes_max"`
}

type ValidatorSeq added in v0.1.6

type ValidatorSeq interface {
	BulkUpsert(records []model.ValidatorSeq) error
	FindByHeight(h int64) ([]model.ValidatorSeq, error)
	FindByHeightAndAddress(height int64, address string) (*model.ValidatorSeq, error)
	FindMostRecent() (*model.ValidatorSeq, error)
	FindLastByAddress(address string, limit int64) ([]model.ValidatorSeq, error)
	DeleteOlderThan(purgeThreshold time.Time) (*int64, error)
	Summarize(interval types.SummaryInterval, activityPeriods []ActivityPeriodRow) ([]ValidatorSeqSummary, error)
}

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

type ValidatorSummary interface {
	BulkUpsert(records []model.ValidatorSummary) error
	Find(query *model.ValidatorSummary) (*model.ValidatorSummary, error)
	FindActivityPeriods(interval types.SummaryInterval, indexVersion int64) ([]ActivityPeriodRow, error)
	FindSummary(interval types.SummaryInterval, period string) ([]ValidatorSummaryRow, error)
	FindSummaryByAddress(address string, interval types.SummaryInterval, period string) ([]model.ValidatorSummary, error)
	FindMostRecent() (*model.ValidatorSummary, error)
	FindMostRecentByInterval(interval types.SummaryInterval) (*model.ValidatorSummary, error)
	DeleteOlderThan(interval types.SummaryInterval, purgeThreshold time.Time) (*int64, error)
}

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"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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