minedev

package
v0.0.0-...-3f068a8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)
View Source
const (
	STATUS_OK      = 0
	STATUS_DELETED = 1
	STATUS_INVALID = 99
)
View Source
const (
	PLOT_STATUS_UNUSED   = 0 //未选中,未使用
	PLOT_STATUS_PLOTTING = 1 //已选中,p盘中
	PLOT_STATUS_PAUSED   = 2 //已选中,p盘暂停中
	PLOT_STATUS_STOPED   = 3 //未选中,p盘主动取消
	PLOT_STATUS_DONE     = 9 //已选中,p盘完成
)
View Source
const (
	DEV_STATUS_UNBIND   = "unbind"
	DEV_STATUS_BINDED   = "binded"
	DEV_STATUS_SYNCING  = "syncing"
	DEV_STATUS_PLOTTING = "plotting"
	DEV_STATUS_MINNING  = "minning"
	DEV_STATUS_WAITING  = "waiting"
)
View Source
const (
	ACTION_SELECT   = "SELECT"
	ACTION_UNSELECT = "UNSELECT"
	ACTION_RMDATA   = "RMDATA"
)
View Source
const (
	DefaultTarget = "Living"
	DefaultStatus = true
)
View Source
const (
	DEFAULT_PLOTDIR = "${MOUNTPOINT}/plotdata/"
)
View Source
const (
	DefaultTimeFormat = "2006-01-02 15:04:05"
)

Variables

View Source
var (
	DefaultDescription = "description.xml"
	DefaultDatabase    = "database.sqlite"
	RWLock             sync.RWMutex
)
View Source
var PlotpathsUpdater = make(chan string, 100)

Functions

func CloseRows

func CloseRows(r *sql.Rows)

func CloseStmt

func CloseStmt(s *sql.Stmt)

func GetDbInstance

func GetDbInstance() *sql.DB

func GetSettingPlotdirs

func GetSettingPlotdirs() (plotpaths string)

func Init

func Init(datadir string)

func Start

func Start()

Types

type Host

type Host struct {
	Hostname   string `json:"hostname"`
	Status     string `json:"status"`
	CreateTime string `json:"create_time"`
	ModifyTime string `json:"modify_time"`
}

func (*Host) ClsHostInfo

func (h *Host) ClsHostInfo() (e error)

func (*Host) ModHostInfo

func (h *Host) ModHostInfo() (e error)

func (*Host) QueryHostInfo

func (h *Host) QueryHostInfo() (e error)

type IEthereum

type IEthereum interface {
	StopMining()
	IsMining() bool
	Miner() *miner.Miner
	IsPloting() bool
	Downloader() *downloader.Downloader
	Plotter() *plotter.Plotter
	Engine() consensus.Engine
}

type InputSettingAction

type InputSettingAction string

type InputSettingPlotdir

type InputSettingPlotdir struct {
	Plot
	Action InputSettingAction `json:"action"`
}

type MineDevice

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

func New

func New(ieth IEthereum) *MineDevice

func (*MineDevice) Bind

func (dev *MineDevice) Bind(miner common.Address, auth string) (r Result)

func (*MineDevice) Getting

func (dev *MineDevice) Getting(name string) (r Result)

func (*MineDevice) GettingHostname

func (dev *MineDevice) GettingHostname() (r Result)

func (*MineDevice) GettingPlotdirs

func (dev *MineDevice) GettingPlotdirs() (r Result)

func (*MineDevice) Login

func (dev *MineDevice) Login() (r Result)

func (*MineDevice) Restart

func (dev *MineDevice) Restart() (r Result)

func (*MineDevice) Setting

func (dev *MineDevice) Setting(name string, value string) (r Result)

func (*MineDevice) SettingHostname

func (dev *MineDevice) SettingHostname(hostname string) (r Result)

func (*MineDevice) SettingPlotdirs

func (dev *MineDevice) SettingPlotdirs(value string) (r Result)

func (*MineDevice) Status

func (dev *MineDevice) Status() (r Result)

func (*MineDevice) Unbind

func (dev *MineDevice) Unbind(miner common.Address, auth string) (r Result)

type Plot

type Plot struct {
	Id        uint64 `json:"id"`
	Name      string `json:"name"`
	Path      string `json:"path"`
	Uuid      string `json:"uuid"`
	DiskSize  uint64 `json:"disksize"`
	FreeSize  uint64 `json:"freesize"`
	PlotSeed  string `json:"plotseed"`
	PlotSize  uint64 `json:"plotsize"`
	PlotDir   string `json:"plotdir"`
	PlotParam string `json:"plotparam"`
	Status    int    `json:"status"`
}

func (*Plot) GetAllPlotWorks

func (p *Plot) GetAllPlotWorks() (retworks []plotter.Work)

func (*Plot) GetFullPlotPath

func (plot *Plot) GetFullPlotPath() (plotpath string)

func (*Plot) InsertNew

func (p *Plot) InsertNew() (err error)

func (*Plot) NonceAllocate

func (p *Plot) NonceAllocate(id, plotSeed string, plotsize uint64) (s uint64, n uint64, e error)

func (*Plot) PlotSelectedByIds

func (p *Plot) PlotSelectedByIds(id uint64, path string) (err error)

func (*Plot) PlotUnselectedByIds

func (p *Plot) PlotUnselectedByIds(id uint64, path string) (err error)

func (*Plot) QueryAllPlotInfo

func (p *Plot) QueryAllPlotInfo() (plots []Plot, e error)

func (*Plot) QueryByIds

func (p *Plot) QueryByIds(id uint64, path string) (err error)

func (*Plot) UpdateByIds

func (p *Plot) UpdateByIds(id uint64) (err error)

func (*Plot) UpdatePlotParamById

func (p *Plot) UpdatePlotParamById(id uint64) (err error)

type Result

type Result map[string]interface{}

type UPnPDevice

type UPnPDevice struct {
	*upnp.Device
	Target string
	Status bool
}
var Instance *UPnPDevice

func GetInstance

func GetInstance() *UPnPDevice

func NewLightDevice

func NewLightDevice() (*UPnPDevice, error)

func (*UPnPDevice) ActionRequestReceived

func (self *UPnPDevice) ActionRequestReceived(action *upnp.Action) upnp.Error

func (*UPnPDevice) RefreshDeviceData

func (self *UPnPDevice) RefreshDeviceData()

type Uatk

type Uatk struct {
	SessionId     string `json:"sessionid"`
	SessionValues string `json:"sessionvalues"`
	CreateTime    string `json:"create_time"`
	ModifyTime    string `json:"modify_time"`
}

func (*Uatk) InsertSessionValues

func (u *Uatk) InsertSessionValues() (e error)

func (*Uatk) QuerySessionValues

func (u *Uatk) QuerySessionValues(uatk string) (uatkinfo UatkInfo, e error)

type UatkInfo

type UatkInfo struct {
	Username string `json:"username"`
}

type User

type User struct {
	Username   string `json:"username"`
	Password   string `json:"password"`
	CreateTime string `json:"create_time"`
	ModifyTime string `json:"modify_time"`
}

func (*User) ClsUser

func (uo *User) ClsUser() (e error)

func (*User) ModBindUser

func (uo *User) ModBindUser() (e error)

func (*User) QueryBindUser

func (uo *User) QueryBindUser() (u User, e error)

Jump to

Keyboard shortcuts

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