repositories

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DowntimeRepo added in v0.2.0

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

func NewDowntimeRepo added in v0.2.0

func NewDowntimeRepo(db *storm.DB) *DowntimeRepo

func (*DowntimeRepo) FindDowntimesInsideInterval added in v0.3.0

func (r *DowntimeRepo) FindDowntimesInsideInterval(nodeID string, from time.Time, to time.Time) ([]models.Downtime, error)

func (*DowntimeRepo) Save added in v0.2.0

func (r *DowntimeRepo) Save(downtime *models.Downtime) error

type DowntimeRepository added in v0.2.0

type DowntimeRepository interface {
	Save(downtime *models.Downtime) error
	// FindDowntimesInsideInterval returns all models.Downtime that started or ended inside interval
	// defined with arguments from and to
	FindDowntimesInsideInterval(nodeID string, from time.Time, to time.Time) ([]models.Downtime, error)
}

type FeeRepository added in v0.4.0

type FeeRepository interface {
	RecordNewFee(nodeID string, newFee int64) error
	GetAllFees() (*[]models.Fee, error)
}

func NewFeeRepo added in v0.4.0

func NewFeeRepo(db *storm.DB) FeeRepository

type MetricsRepository added in v0.2.0

type MetricsRepository interface {
	FindByID(ID string) (*models.Metrics, error)
	Save(metrics *models.Metrics) error
	SaveAndCheckIfFirstEntry(metrics *models.Metrics) (bool, error)
	GetAll() (*[]models.Metrics, error)
	GetLatestBlockMetrics() (*models.LatestBlockMetrics, error)
}

func NewMetricsRepo

func NewMetricsRepo(db *storm.DB) MetricsRepository

type NodeRepository added in v0.2.0

type NodeRepository interface {
	FindByID(ID string) (*models.Node, error)
	Save(node *models.Node) error
	GetAll() (*[]models.Node, error)
	GetActiveNodes(selection string) *[]models.Node
	GetPenalizedNodes() (*[]models.Node, error)
	GetAllActiveNodes() *[]models.Node
	IsNodeActive(ID string) bool
	RemoveNodeFromActive(ID string) error
	AddNodeToActive(ID string) error
	UpdateNodeUsed(node models.Node)
	IncreaseNodeCooldown(ID string) (*models.Node, error)
	ResetNodeCooldown(ID string) (*models.Node, error)
	IsNodeOnCooldown(ID string) (bool, error)
}

func NewNodeRepo

func NewNodeRepo(db *storm.DB) NodeRepository

type PayoutRepository added in v0.3.0

type PayoutRepository interface {
	Save(payment *models.Payout) error
	GetAll() (*[]models.Payout, error)
	FindLatestPayout() (*models.Payout, error)
}

func NewPayoutRepo added in v0.3.0

func NewPayoutRepo(db *storm.DB) PayoutRepository

type PingRepository added in v0.2.0

type PingRepository interface {
	FindByNodeID(nodeId string) (*models.Ping, error)
	Save(ping *models.Ping) error
	GetAll() (*[]models.Ping, error)
	ResetAllPings() error
	CalculateDowntime(nodeId string, pingTime time.Time) (time.Time, time.Duration, error)
}

func NewPingRepo

func NewPingRepo(db *storm.DB) PingRepository

type RecordRepository added in v0.2.0

type RecordRepository interface {
	Save(record *models.Record) error
	// FindSuccessfulRecordsInsideInterval returns all models.Record that happened inside interval
	// defined with arguments from and to
	FindSuccessfulRecordsInsideInterval(nodeID string, from time.Time, to time.Time) ([]models.Record, error)
	CountSuccessfulRequests() (int, error)
	CountFailedRequests() (int, error)
}

func NewRecordRepo added in v0.2.0

func NewRecordRepo(db *storm.DB) RecordRepository

type Repos added in v0.2.0

type Repos struct {
	NodeRepo     NodeRepository
	PingRepo     PingRepository
	MetricsRepo  MetricsRepository
	RecordRepo   RecordRepository
	DowntimeRepo DowntimeRepository
	PayoutRepo   PayoutRepository
	FeeRepo      FeeRepository
}

Repos structure holds all available repositories

Jump to

Keyboard shortcuts

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