redis

package
v0.0.0-...-bfed37f Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelAuth    = "auth"
	ChannelPoint   = "point"
	ChannelWeb     = "web"
	ChannelManager = "mgr"
)
View Source
const (
	OpcodeChangeServStatus = "change-serv-status"
	OpcodeLoadIP           = "inbound-ip"
	OpcodeWhiteList        = "white-list"
	OpcodeMinerSub         = "miner-sub"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint string `json:"endpoint"`
	Password string `json:"password"`
	Database int64  `json:"database"`
	PoolSize int    `json:"poolSize"`
}

type Miner

type Miner struct {
	LastBeat int64 `json:"lastBeat"`
	HR       int64 `json:"hr"`
	Offline  bool  `json:"offline"`
	// contains filtered or unexported fields
}

type PaymentCharts

type PaymentCharts struct {
	Timestamp  int64  `json:"x"`
	TimeFormat string `json:"timeFormat"`
	Amount     int64  `json:"amount"`
}

type PoolCharts

type PoolCharts struct {
	Timestamp  int64  `json:"x"`
	TimeFormat string `json:"timeFormat"`
	PoolHash   int64  `json:"y"`
}

type PubSub

type PubSub interface {
	RedisMessage(string)
}

type RedisClient

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

func NewRedisClient

func NewRedisClient(cfg *Config) *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) DelAPIToken

func (r *RedisClient) DelAPIToken(jstSign string) error

func (*RedisClient) GetAPIToken

func (r *RedisClient) GetAPIToken(jstSign string) (string, error)

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) GetNodeHeight

func (r *RedisClient) GetNodeHeight(id string) (int64, error)

func (*RedisClient) GetNodeStates

func (r *RedisClient) GetNodeStates() ([]map[string]interface{}, error)

func (*RedisClient) GetPaymentCharts

func (r *RedisClient) GetPaymentCharts(login string) (stats []*PaymentCharts, err error)

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) GetToken

func (r *RedisClient) GetToken(userName string) (string, 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) IsPayoutsLocked

func (r *RedisClient) IsPayoutsLocked() (bool, error)

func (*RedisClient) LockPayouts

func (r *RedisClient) LockPayouts(login string, amount int64) error

func (*RedisClient) Publish

func (r *RedisClient) Publish(channel string, opcode string, data string, reply string) (int64, error)

func (*RedisClient) SetAPIToken

func (r *RedisClient) SetAPIToken(jstSign string, jwtFullStr string, expirationMin int64) error

func (*RedisClient) SetReportedtHashrates

func (r *RedisClient) SetReportedtHashrates(logins map[string]string, WorkerId string) error

func (*RedisClient) SetToken

func (r *RedisClient) SetToken(userName string, jwtSign string, expirationMin int64) error

func (*RedisClient) UnlockPayouts

func (r *RedisClient) UnlockPayouts() error

func (*RedisClient) WriteAlarmBeat

func (r *RedisClient) WriteAlarmBeat(login string, exp time.Duration) error

func (*RedisClient) WriteMinerCharts

func (r *RedisClient) WriteMinerCharts(time1 int64, time2, k string, hash, largeHash, workerOnline int64, share int64, report int64) error

func (*RedisClient) WriteNodeState

func (r *RedisClient) WriteNodeState(id string, height uint64, diff *big.Int) error

func (*RedisClient) WritePoolCharts

func (r *RedisClient) WritePoolCharts(time1 int64, time2 string, poolHash string) error

WritePoolCharts is pool charts

type SumRewardData

type SumRewardData struct {
	Interval int64  `json:"inverval"`
	Reward   int64  `json:"reward"`
	Name     string `json:"name"`
	Offset   int64  `json:"offset"`
}

type Worker

type Worker struct {
	Miner
	TotalHR        int64   `json:"hr2"`
	WorkerDiff     int64   `json:"difficulty"`
	WorkerHostname string  `json:"hostname"`
	Size           int64   `json:"size"`
	RoundShare     float32 `json:"rshare"`
	Reported       int64   `json:"reported"`
	DevId          string  `json:"devid"`
}

Jump to

Keyboard shortcuts

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