Documentation ¶
Index ¶
- func UpdateStats(paymentRepo PaymentRepo, workRepo WorkRepo) error
- type PaymentRepo
- type PaymentService
- func (s *PaymentService) BatchCreateSendRequests(tx *gorm.DB, sendRequests []serializableModels.SendRequest) error
- func (s *PaymentService) GetPendingPayments(tx *gorm.DB) ([]serializableModels.SendRequest, error)
- func (s *PaymentService) GetTotalPaidBanano() (float64, error)
- func (s *PaymentService) SetBlockHash(tx *gorm.DB, sendId string, blockHash string) error
- type ServicesResult
- type Top10Result
- type UnpaidSumResult
- type UnpaidWorkResult
- type UserRepo
- type UserService
- func (s *UserService) Authenticate(loginInput *model.LoginInput) *models.User
- func (s *UserService) ChangePassword(email string, userInput *model.ChangePasswordInput) error
- func (s *UserService) CreateMockUsers() error
- func (s *UserService) CreateService(email string, serviceName string, serviceWebsite string) (string, error)
- func (s *UserService) CreateUser(userInput *model.UserInput, doEmail bool) (*models.User, error)
- func (s *UserService) DeleteUser(id uuid.UUID) error
- func (s *UserService) GenerateResetPasswordRequest(resetPasswordInput *model.ResetPasswordInput, doEmail bool) (string, error)
- func (s *UserService) GenerateServiceToken() string
- func (s *UserService) GetAllUsers() ([]*models.User, error)
- func (s *UserService) GetNumberServices() (int64, error)
- func (s *UserService) GetUser(id *uuid.UUID, email *string) (*models.User, error)
- func (s *UserService) SendConfirmEmailEmail(userEmail string, userType models.UserType, actuallyDoEmail bool) error
- func (s *UserService) VerifyEmailToken(verifyEmail *model.VerifyEmailInput) (bool, error)
- func (s *UserService) VerifyService(verifyService *model.VerifyServiceInput) (bool, error)
- type WorkMessage
- type WorkRepo
- type WorkService
- func (s *WorkService) GetServiceStats() ([]ServicesResult, error)
- func (s *WorkService) GetTopContributors(limit int) ([]Top10Result, error)
- func (s *WorkService) GetUnpaidWorkCount(tx *gorm.DB) ([]UnpaidWorkResult, error)
- func (s *WorkService) GetUnpaidWorkCountAndMarkAllPaid(tx *gorm.DB) ([]UnpaidWorkResult, error)
- func (s *WorkService) GetUnpaidWorkSum() (int, error)
- func (s *WorkService) GetUnpaidWorkSumForUser(email string) (int, error)
- func (s *WorkService) GetWorkRecord(hash string) (*models.WorkResult, error)
- func (s *WorkService) RetrieveWorkFromCache(hash string, difficultyMultiplier int) (string, error)
- func (s *WorkService) SaveOrUpdateWorkResult(workMessage WorkMessage) (*models.WorkResult, error)
- func (s *WorkService) StatsWorker(statsChan <-chan WorkMessage, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateStats ¶
func UpdateStats(paymentRepo PaymentRepo, workRepo WorkRepo) error
Types ¶
type PaymentRepo ¶
type PaymentRepo interface { BatchCreateSendRequests(tx *gorm.DB, sendRequests []serializableModels.SendRequest) error GetPendingPayments(tx *gorm.DB) ([]serializableModels.SendRequest, error) SetBlockHash(tx *gorm.DB, sendId string, blockHash string) error GetTotalPaidBanano() (float64, error) }
type PaymentService ¶
func NewPaymentService ¶
func NewPaymentService(db *gorm.DB) *PaymentService
func (*PaymentService) BatchCreateSendRequests ¶
func (s *PaymentService) BatchCreateSendRequests(tx *gorm.DB, sendRequests []serializableModels.SendRequest) error
Create payments in database
func (*PaymentService) GetPendingPayments ¶
func (s *PaymentService) GetPendingPayments(tx *gorm.DB) ([]serializableModels.SendRequest, error)
Get all payments with null block hash
func (*PaymentService) GetTotalPaidBanano ¶
func (s *PaymentService) GetTotalPaidBanano() (float64, error)
Get total paid sum
func (*PaymentService) SetBlockHash ¶
Update payment with block hash
type ServicesResult ¶
type Top10Result ¶
type UnpaidSumResult ¶
type UnpaidSumResult struct {
DifficultySum int `json:"difficulty_sum"`
}
type UnpaidWorkResult ¶
type UnpaidWorkResult struct { UnpaidSumResult UnpaidCount int `json:"unpaid_count"` ProvidedBy uuid.UUID `json:"provided_by"` BanAddress string `json:"ban_address"` }
type UserRepo ¶
type UserRepo interface { CreateUser(userInput *model.UserInput, doEmail bool) (*models.User, error) SendConfirmEmailEmail(userEmail string, userType models.UserType, actuallyDoEmail bool) error CreateMockUsers() error DeleteUser(id uuid.UUID) error GetUser(id *uuid.UUID, email *string) (*models.User, error) GetAllUsers() ([]*models.User, error) Authenticate(loginInput *model.LoginInput) *models.User VerifyEmailToken(verifyEmail *model.VerifyEmailInput) (bool, error) VerifyService(verifyService *model.VerifyServiceInput) (bool, error) GenerateResetPasswordRequest(resetPasswordInput *model.ResetPasswordInput, doEmail bool) (string, error) GenerateServiceToken() string CreateService(email string, serviceName string, serviceWebsite string) (string, error) GetNumberServices() (int64, error) ChangePassword(email string, userInput *model.ChangePasswordInput) error }
type UserService ¶
func NewUserService ¶
func NewUserService(db *gorm.DB) *UserService
func (*UserService) Authenticate ¶
func (s *UserService) Authenticate(loginInput *model.LoginInput) *models.User
Compare password to hashed password, return true if match false otherwise
func (*UserService) ChangePassword ¶
func (s *UserService) ChangePassword(email string, userInput *model.ChangePasswordInput) error
func (*UserService) CreateMockUsers ¶
func (s *UserService) CreateMockUsers() error
func (*UserService) CreateService ¶
func (*UserService) CreateUser ¶
func (*UserService) DeleteUser ¶
func (s *UserService) DeleteUser(id uuid.UUID) error
func (*UserService) GenerateResetPasswordRequest ¶
func (s *UserService) GenerateResetPasswordRequest(resetPasswordInput *model.ResetPasswordInput, doEmail bool) (string, error)
func (*UserService) GenerateServiceToken ¶
func (s *UserService) GenerateServiceToken() string
Generate a service token (for services to request work)
func (*UserService) GetAllUsers ¶
func (s *UserService) GetAllUsers() ([]*models.User, error)
func (*UserService) GetNumberServices ¶
func (s *UserService) GetNumberServices() (int64, error)
func (*UserService) SendConfirmEmailEmail ¶
func (*UserService) VerifyEmailToken ¶
func (s *UserService) VerifyEmailToken(verifyEmail *model.VerifyEmailInput) (bool, error)
func (*UserService) VerifyService ¶
func (s *UserService) VerifyService(verifyService *model.VerifyServiceInput) (bool, error)
type WorkMessage ¶
type WorkMessage struct { BlockAward bool `json:"block_award"` RequestedByEmail string `json:"requestedByEmail"` ProvidedByEmail string `json:"providedByEmail"` Hash string `json:"hash"` Result string `json:"result"` DifficultyMultiplier int `json:"difficulty_multiplier"` Precache bool `json:"precache"` }
type WorkRepo ¶
type WorkRepo interface { SaveOrUpdateWorkResult(workMessage WorkMessage) (*models.WorkResult, error) GetWorkRecord(hash string) (*models.WorkResult, error) StatsWorker(statsChan <-chan WorkMessage, blockAwardedChan *chan serializableModels.ClientMessage) GetUnpaidWorkSumForUser(email string) (int, error) GetUnpaidWorkSum() (int, error) RetrieveWorkFromCache(hash string, difficultyMultiplier int) (string, error) GetUnpaidWorkCount(tx *gorm.DB) ([]UnpaidWorkResult, error) GetUnpaidWorkCountAndMarkAllPaid(tx *gorm.DB) ([]UnpaidWorkResult, error) GetTopContributors(limit int) ([]Top10Result, error) GetServiceStats() ([]ServicesResult, error) }
type WorkService ¶
func NewWorkService ¶
func NewWorkService(db *gorm.DB, userRepo UserRepo) *WorkService
func (*WorkService) GetServiceStats ¶
func (s *WorkService) GetServiceStats() ([]ServicesResult, error)
func (*WorkService) GetTopContributors ¶
func (s *WorkService) GetTopContributors(limit int) ([]Top10Result, error)
func (*WorkService) GetUnpaidWorkCount ¶
func (s *WorkService) GetUnpaidWorkCount(tx *gorm.DB) ([]UnpaidWorkResult, error)
func (*WorkService) GetUnpaidWorkCountAndMarkAllPaid ¶
func (s *WorkService) GetUnpaidWorkCountAndMarkAllPaid(tx *gorm.DB) ([]UnpaidWorkResult, error)
func (*WorkService) GetUnpaidWorkSum ¶
func (s *WorkService) GetUnpaidWorkSum() (int, error)
Summate the difficulty of unpaid works for all users
func (*WorkService) GetUnpaidWorkSumForUser ¶
func (s *WorkService) GetUnpaidWorkSumForUser(email string) (int, error)
func (*WorkService) GetWorkRecord ¶
func (s *WorkService) GetWorkRecord(hash string) (*models.WorkResult, error)
func (*WorkService) RetrieveWorkFromCache ¶
func (s *WorkService) RetrieveWorkFromCache(hash string, difficultyMultiplier int) (string, error)
func (*WorkService) SaveOrUpdateWorkResult ¶
func (s *WorkService) SaveOrUpdateWorkResult(workMessage WorkMessage) (*models.WorkResult, error)
func (*WorkService) StatsWorker ¶
func (s *WorkService) StatsWorker(statsChan <-chan WorkMessage, blockAwardedChan *chan serializableModels.ClientMessage)
Click to show internal directories.
Click to hide internal directories.