Documentation ¶
Index ¶
- Constants
- type Config
- type IMysqlDB
- type Miner
- type PaymentCharts
- type PendingPayment
- type PoolCharts
- type PubSub
- type RedisClient
- func (r *RedisClient) BgSave() (string, error)
- func (r *RedisClient) Check() (string, error)
- func (r *RedisClient) CheckPoWExist(height uint64, params []string) (bool, error)
- func (r *RedisClient) Client() *redis.Client
- func (r *RedisClient) CollectLuckStats(windows []int) (map[string]interface{}, error)
- func (r *RedisClient) CollectStats(smallWindow time.Duration, maxBlocks, maxPayments int64) (map[string]interface{}, error)
- func (r *RedisClient) CollectWorkersAllStats(sWindow, lWindow time.Duration, login string, mapReportRate map[string]int64) (map[string]interface{}, error)
- func (r *RedisClient) CollectWorkersStats(sWindow, lWindow time.Duration, login string, mapReportRate map[string]int64) (map[string]interface{}, error)
- func (r *RedisClient) CollectWorkersStatsEx(sWindow, lWindow time.Duration, login string) (int64, int64, int64, int64)
- func (r *RedisClient) DeleteRoundBlock(roundHeight int64, nonce string) *redis.IntCmd
- func (r *RedisClient) FlushStaleStats(window, largeWindow time.Duration) (int64, error)
- func (r *RedisClient) GetAlarmBeat(login string) (bool, error)
- func (r *RedisClient) GetAllMinerAccount() (account []string, err error)
- func (r *RedisClient) GetAllReportedtHashrate(login string) (int64, error)
- func (r *RedisClient) GetBalance(login string) (int64, error)
- func (r *RedisClient) GetBlacklist() ([]string, error)
- func (r *RedisClient) GetCandidates(maxHeight int64) ([]*types.BlockData, error)
- func (r *RedisClient) GetCurrentHashrate(login string) (int64, error)
- func (r *RedisClient) GetImmatureBlocks(maxHeight int64) ([]*types.BlockData, error)
- func (r *RedisClient) GetMinerCharts(hashNum int64, login string) (stats []*types.MinerCharts, err error)
- func (r *RedisClient) GetMinerStats(login string, maxPayments int64) (map[string]interface{}, error)
- func (r *RedisClient) GetNodeHeight(id string) (int64, error)
- func (r *RedisClient) GetNodeStates() ([]map[string]interface{}, error)
- func (r *RedisClient) GetPayees() ([]string, error)
- func (r *RedisClient) GetPaymentCharts(login string) (stats []*PaymentCharts, err error)
- func (r *RedisClient) GetPendingPayments() []*PendingPayment
- func (r *RedisClient) GetPoolCharts(poolHashLen int64) (stats []*PoolCharts, err error)
- func (r *RedisClient) GetReportedtHashrate(login string) (map[string]int64, error)
- func (r *RedisClient) GetRewards(login string) ([]*types.RewardData, error)
- func (r *RedisClient) GetRoundShares(height int64, nonce string) (map[string]int64, error)
- func (r *RedisClient) GetToken(devId string) (string, error)
- func (r *RedisClient) GetTotalShares() (int64, error)
- func (r *RedisClient) GetWhitelist() ([]string, error)
- func (r *RedisClient) InitAlarmBeat(alarmList []string, exp time.Duration) error
- func (r *RedisClient) InitPubSub(name string, proc PubSub)
- func (r *RedisClient) IsMinerExists(login string) (bool, error)
- func (r *RedisClient) IsPayoutsLocked() (bool, error)
- func (r *RedisClient) IsRoundNumber(roundHeight int64, nonce string) (bool, error)
- func (r *RedisClient) LockPayouts(login string, amount int64) error
- func (r *RedisClient) Publish(channel string, opcode string, data string, reply string) (int64, error)
- func (r *RedisClient) RollbackBalance(login string, amount int64) error
- func (r *RedisClient) SetDB(db IMysqlDB)
- func (r *RedisClient) SetReportedtHashrates(logins map[string]string, WorkerId string) error
- func (r *RedisClient) SetToken(devId string, jwtSign string, expirationMin int64) error
- func (r *RedisClient) UnlockPayouts() error
- func (r *RedisClient) UpdateBalance(login string, amount int64) error
- func (r *RedisClient) WriteAlarmBeat(login string, exp time.Duration) error
- func (r *RedisClient) WriteBlock(login, devId, id string, params []string, diff, roundDiff int64, height uint64, ...) (bool, error)
- func (r *RedisClient) WriteImmatureBlock(block *types.BlockData, roundRewards map[string]int64) error
- func (r *RedisClient) WriteMaturedBlock(block *types.BlockData, roundRewards map[string]int64) error
- func (r *RedisClient) WriteMinerCharts(time1 int64, time2, k string, hash, largeHash, workerOnline int64, share int64, ...) error
- func (r *RedisClient) WriteNodeState(id string, height uint64, diff *big.Int) error
- func (r *RedisClient) WriteOrphan(block *types.BlockData) error
- func (r *RedisClient) WritePayment(login, txHash string, amount int64) error
- func (r *RedisClient) WritePendingOrphans(blocks []*types.BlockData) error
- func (r *RedisClient) WritePoolCharts(time1 int64, time2 string, poolHash string) error
- func (r *RedisClient) WriteReward(login string, amount int64, percent *big.Rat, immature bool, ...) error
- func (r *RedisClient) WriteShare(login, devId, id string, params []string, diff int64, height uint64, ...) (bool, error)
- type SumRewardData
- type Worker
Constants ¶
View Source
const ( ChannelProxy = "proxy" ChannelUnlocker = "unlocker" ChannelApi = "api" ChannelPayout = "payout" )
View Source
const ( OpcodeLoadID = "inbound-id" OpcodeLoadIP = "inbound-ip" OpcodeWhiteList = "white-list" OpcodeMinerSub = "miner-sub" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMysqlDB ¶
type IMysqlDB interface { WriteCandidates(height uint64, params []string, nowTime string, ts int64, roundDiff int64, totalShares int64) CollectLuckStats(windowMax int64) ([]*types.BlockData, error) CollectStats(maxBlocks int64) ([]*types.BlockData, []*types.BlockData, []*types.BlockData, int, []map[string]interface{}, int64, error) GetMinerStats(login string, maxPayments int64) (map[string]interface{}, error) GetChartRewardList(login string, maxList int) ([]*types.RewardData, error) }
type PaymentCharts ¶
type PendingPayment ¶
type PoolCharts ¶
type RedisClient ¶
type RedisClient struct { // contains filtered or unexported fields }
func NewRedisClient ¶
func NewRedisClient(cfg *Config, prefix string, proxyDiff int64, pplns int64) *RedisClient
func (*RedisClient) BgSave ¶
func (r *RedisClient) BgSave() (string, error)
func (*RedisClient) Check ¶
func (r *RedisClient) Check() (string, error)
func (*RedisClient) CheckPoWExist ¶
func (r *RedisClient) CheckPoWExist(height uint64, params []string) (bool, error)
func (*RedisClient) Client ¶
func (r *RedisClient) Client() *redis.Client
func (*RedisClient) CollectLuckStats ¶
func (r *RedisClient) CollectLuckStats(windows []int) (map[string]interface{}, error)
func (*RedisClient) CollectStats ¶
func (*RedisClient) CollectWorkersAllStats ¶
func (*RedisClient) CollectWorkersStats ¶
func (*RedisClient) CollectWorkersStatsEx ¶
func (*RedisClient) DeleteRoundBlock ¶
func (r *RedisClient) DeleteRoundBlock(roundHeight int64, nonce string) *redis.IntCmd
func (*RedisClient) FlushStaleStats ¶
func (r *RedisClient) FlushStaleStats(window, largeWindow time.Duration) (int64, error)
WARNING: Must run it periodically to flush out of window hashrate entries
func (*RedisClient) GetAlarmBeat ¶
func (r *RedisClient) GetAlarmBeat(login string) (bool, error)
func (*RedisClient) GetAllMinerAccount ¶
func (r *RedisClient) GetAllMinerAccount() (account []string, err error)
func (*RedisClient) GetAllReportedtHashrate ¶
func (r *RedisClient) GetAllReportedtHashrate(login string) (int64, error)
func (*RedisClient) GetBalance ¶
func (r *RedisClient) GetBalance(login string) (int64, error)
func (*RedisClient) GetBlacklist ¶
func (r *RedisClient) GetBlacklist() ([]string, error)
Always returns list of addresses. If Redis fails it will return empty list.
func (*RedisClient) GetCandidates ¶
func (r *RedisClient) GetCandidates(maxHeight int64) ([]*types.BlockData, error)
func (*RedisClient) GetCurrentHashrate ¶
func (r *RedisClient) GetCurrentHashrate(login string) (int64, error)
func (*RedisClient) GetImmatureBlocks ¶
func (r *RedisClient) GetImmatureBlocks(maxHeight int64) ([]*types.BlockData, error)
func (*RedisClient) GetMinerCharts ¶
func (r *RedisClient) GetMinerCharts(hashNum int64, login string) (stats []*types.MinerCharts, err error)
func (*RedisClient) GetMinerStats ¶
func (r *RedisClient) GetMinerStats(login string, maxPayments int64) (map[string]interface{}, error)
func (*RedisClient) GetNodeHeight ¶
func (r *RedisClient) GetNodeHeight(id string) (int64, error)
func (*RedisClient) GetNodeStates ¶
func (r *RedisClient) GetNodeStates() ([]map[string]interface{}, error)
func (*RedisClient) GetPayees ¶
func (r *RedisClient) GetPayees() ([]string, error)
func (*RedisClient) GetPaymentCharts ¶
func (r *RedisClient) GetPaymentCharts(login string) (stats []*PaymentCharts, err error)
func (*RedisClient) GetPendingPayments ¶
func (r *RedisClient) GetPendingPayments() []*PendingPayment
func (*RedisClient) GetPoolCharts ¶
func (r *RedisClient) GetPoolCharts(poolHashLen int64) (stats []*PoolCharts, err error)
func (*RedisClient) GetReportedtHashrate ¶
func (r *RedisClient) GetReportedtHashrate(login string) (map[string]int64, error)
func (*RedisClient) GetRewards ¶
func (r *RedisClient) GetRewards(login string) ([]*types.RewardData, error)
func (*RedisClient) GetRoundShares ¶
func (*RedisClient) GetTotalShares ¶
func (r *RedisClient) GetTotalShares() (int64, error)
func (*RedisClient) GetWhitelist ¶
func (r *RedisClient) GetWhitelist() ([]string, error)
Always returns list of IPs. If Redis fails it will return empty list.
func (*RedisClient) InitAlarmBeat ¶
func (r *RedisClient) InitAlarmBeat(alarmList []string, exp time.Duration) error
func (*RedisClient) InitPubSub ¶
func (r *RedisClient) InitPubSub(name string, proc PubSub)
func (*RedisClient) IsMinerExists ¶
func (r *RedisClient) IsMinerExists(login string) (bool, error)
func (*RedisClient) IsPayoutsLocked ¶
func (r *RedisClient) IsPayoutsLocked() (bool, error)
func (*RedisClient) IsRoundNumber ¶
func (r *RedisClient) IsRoundNumber(roundHeight int64, nonce string) (bool, error)
func (*RedisClient) LockPayouts ¶
func (r *RedisClient) LockPayouts(login string, amount int64) error
func (*RedisClient) RollbackBalance ¶
func (r *RedisClient) RollbackBalance(login string, amount int64) error
func (*RedisClient) SetDB ¶
func (r *RedisClient) SetDB(db IMysqlDB)
func (*RedisClient) SetReportedtHashrates ¶
func (r *RedisClient) SetReportedtHashrates(logins map[string]string, WorkerId string) error
func (*RedisClient) SetToken ¶
func (r *RedisClient) SetToken(devId string, jwtSign string, expirationMin int64) error
func (*RedisClient) UnlockPayouts ¶
func (r *RedisClient) UnlockPayouts() error
func (*RedisClient) UpdateBalance ¶
func (r *RedisClient) UpdateBalance(login string, amount int64) error
UpdateBalance Deduct miner's balance for payment
func (*RedisClient) WriteAlarmBeat ¶
func (r *RedisClient) WriteAlarmBeat(login string, exp time.Duration) error
func (*RedisClient) WriteBlock ¶
func (*RedisClient) WriteImmatureBlock ¶
func (*RedisClient) WriteMaturedBlock ¶
func (*RedisClient) WriteMinerCharts ¶
func (*RedisClient) WriteNodeState ¶
func (*RedisClient) WriteOrphan ¶
func (r *RedisClient) WriteOrphan(block *types.BlockData) error
func (*RedisClient) WritePayment ¶
func (r *RedisClient) WritePayment(login, txHash string, amount int64) error
func (*RedisClient) WritePendingOrphans ¶
func (r *RedisClient) WritePendingOrphans(blocks []*types.BlockData) error
func (*RedisClient) WritePoolCharts ¶
func (r *RedisClient) WritePoolCharts(time1 int64, time2 string, poolHash string) error
WritePoolCharts is pool charts
func (*RedisClient) WriteReward ¶
type SumRewardData ¶
Click to show internal directories.
Click to hide internal directories.