validator

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

func NewRepository

func NewRepository(db *pg.DB) *Repository

func (Repository) DeleteStakesByValidatorIds

func (r Repository) DeleteStakesByValidatorIds(idList []uint64) error

func (Repository) DeleteStakesNotInListIds

func (r Repository) DeleteStakesNotInListIds(idList []uint64) error

func (*Repository) FindAllByPK

func (r *Repository) FindAllByPK(validators []*models.Validator) ([]*models.Validator, error)

Find validators by PK Update cache Return slice of validators

func (*Repository) FindIdByPk

func (r *Repository) FindIdByPk(pk string) (uint64, error)

Find validator with public key. Return Validator ID

func (*Repository) FindIdByPkOrCreate

func (r *Repository) FindIdByPkOrCreate(pk string) (uint64, error)

Find validator with public key or create if not exist. Return Validator ID

func (Repository) ResetAllStatuses

func (r Repository) ResetAllStatuses() error

func (*Repository) SaveAllIfNotExist

func (r *Repository) SaveAllIfNotExist(validators []*models.Validator) error

Save list of validators if not exist

func (*Repository) SaveAllStakes

func (r *Repository) SaveAllStakes(stakes []*models.Stake) error

func (*Repository) Update

func (r *Repository) Update(validator *models.Validator) error

func (*Repository) UpdateAll

func (r *Repository) UpdateAll(validators []*models.Validator) error

type Service

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

func NewService

func NewService(env *models.ExtenderEnvironment, nodeApi *minter_node_go_api.MinterNodeApi, repository *Repository,
	addressRepository *address.Repository, coinRepository *coin.Repository, logger *logrus.Entry) *Service

func (*Service) GetStakesFromCandidateResponse

func (s *Service) GetStakesFromCandidateResponse(response *responses.CandidateResponse) ([]*models.Stake, error)

func (*Service) GetUpdateStakesJobChannel

func (s *Service) GetUpdateStakesJobChannel() chan uint64

func (*Service) GetUpdateValidatorsJobChannel

func (s *Service) GetUpdateValidatorsJobChannel() chan uint64

func (*Service) HandleBlockResponse

func (s *Service) HandleBlockResponse(response *responses.BlockResponse) ([]*models.Validator, error)

Get validators PK from response and store it to validators table if not exist

func (*Service) HandleCandidateResponse

func (s *Service) HandleCandidateResponse(response *responses.CandidateResponse) (*models.Validator, []*models.Stake, error)

func (*Service) UpdateStakesWorker

func (s *Service) UpdateStakesWorker(jobs <-chan uint64)

func (*Service) UpdateValidatorsWorker

func (s *Service) UpdateValidatorsWorker(jobs <-chan uint64)

Jump to

Keyboard shortcuts

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