Documentation ¶
Index ¶
- type Repository
- func (r Repository) DeleteStakesByValidatorIds(idList []uint64) error
- func (r Repository) DeleteStakesNotInListIds(idList []uint64) error
- func (r *Repository) FindAllByPK(validators []*models.Validator) ([]*models.Validator, error)
- func (r *Repository) FindIdByPk(pk string) (uint64, error)
- func (r *Repository) FindIdByPkOrCreate(pk string) (uint64, error)
- func (r *Repository) FindValidatorById(id uint64) (*models.Validator, error)
- func (r *Repository) GetActiveValidators() (*[]models.Validator, error)
- func (r Repository) GetCountBlockFromDate(createdAt time.Time) (uint64, error)
- func (r Repository) GetCountDelegators(validatorID uint64) (uint64, error)
- func (r Repository) GetFullSignedCountValidatorBlock(validatorID uint64, createdTime time.Time) (uint64, error)
- func (r Repository) ResetAllStatuses() error
- func (r Repository) ResetAllUptimes() error
- func (r *Repository) SaveAllIfNotExist(validators []*models.Validator) error
- func (r *Repository) SaveAllStakes(stakes []*models.Stake) error
- func (r *Repository) Update(validator *models.Validator) error
- func (r *Repository) UpdateAll(validators []*models.Validator) error
- func (r *Repository) UpdateCountDelegators(validatorID uint64, countDelegators uint64) error
- func (r *Repository) UpdateValidatorUptime(validatorID uint64, uptime float64) error
- type Service
- func (s *Service) GetStakesFromCandidateResponse(response *responses.CandidateResponse) ([]*models.Stake, error)
- func (s *Service) GetUpdateStakesJobChannel() chan uint64
- func (s *Service) GetUpdateValidatorsJobChannel() chan uint64
- func (s *Service) HandleBlockResponse(response *responses.BlockResponse) ([]*models.Validator, error)
- func (s *Service) HandleCandidateResponse(response *responses.CandidateResponse) (*models.Validator, []*models.Stake, error)
- func (s *Service) UpdateStakesWorker(jobs <-chan uint64)
- func (s *Service) UpdateValidatorsWorker(jobs <-chan uint64)
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 ¶
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) FindValidatorById ¶ added in v0.2.5
func (r *Repository) FindValidatorById(id uint64) (*models.Validator, error)
func (*Repository) GetActiveValidators ¶ added in v0.2.6
func (r *Repository) GetActiveValidators() (*[]models.Validator, error)
func (Repository) GetCountBlockFromDate ¶ added in v0.2.5
func (r Repository) GetCountBlockFromDate(createdAt time.Time) (uint64, error)
func (Repository) GetCountDelegators ¶
func (r Repository) GetCountDelegators(validatorID uint64) (uint64, error)
func (Repository) GetFullSignedCountValidatorBlock ¶
func (Repository) ResetAllStatuses ¶
func (r Repository) ResetAllStatuses() error
func (Repository) ResetAllUptimes ¶
func (r Repository) ResetAllUptimes() 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) UpdateCountDelegators ¶
func (r *Repository) UpdateCountDelegators(validatorID uint64, countDelegators uint64) error
func (*Repository) UpdateValidatorUptime ¶
func (r *Repository) UpdateValidatorUptime(validatorID uint64, uptime float64) error
type Service ¶
type Service struct { Repository *Repository // contains filtered or unexported fields }
func NewService ¶
func NewService(env *models.ExtenderEnvironment, nodeApi *noah_node_go_api.NoahNodeApi, Repository *Repository, addressRepository *address.Repository, coinRepository *coin.Repository, logger *logrus.Entry) *Service
func (*Service) GetStakesFromCandidateResponse ¶
func (*Service) GetUpdateStakesJobChannel ¶
func (*Service) GetUpdateValidatorsJobChannel ¶
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 (*Service) UpdateStakesWorker ¶
func (*Service) UpdateValidatorsWorker ¶
Click to show internal directories.
Click to hide internal directories.