plotter

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TASK_STATUS_ERROR    = 0
	TASK_STATUS_NONE     = 1
	TASK_STATUS_PLOTTING = 2
	TASK_STATUS_DONE     = 3
)
View Source
const (
	PROGRESS_MAX = 10000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PloterAllocator

type PloterAllocator interface {
	NonceAllocate(id, plotSeed string, plotsize uint64) (startNonce uint64, nonceQuantity uint64, err error)
}

type PloterStorage

type PloterStorage interface {
	GetAllPlotWorks() []Work
}

type Plotter

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

* Plotter是指P盘器, * 一个进程中的P盘器掌控着所有的P盘信息, * P盘器是所有P盘实际操作的入口, * P盘器的管理以Work为单位

func GetPlotterInstance

func GetPlotterInstance(storage PloterStorage, allocator PloterAllocator) *Plotter

func (*Plotter) IsPlotting

func (plotter *Plotter) IsPlotting() bool

func (*Plotter) Progress

func (plotter *Plotter) Progress() uint

func (*Plotter) Reload

func (plotter *Plotter) Reload()

func (*Plotter) Start

func (plotter *Plotter) Start()

func (*Plotter) Stop

func (plotter *Plotter) Stop()

type TASK_STATUS

type TASK_STATUS int

type Task

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

func JoinTasks

func JoinTasks(arr1 []*Task, arr2 []*Task) (retarr []*Task)

func NewTask

func NewTask(work *Work, startNonce uint64, nonceQuantity uint64) (task *Task)

func RemoveTask

func RemoveTask(tasks []*Task, i int) (newtasks []*Task)

func (*Task) Check

func (t *Task) Check()

type Work

type Work struct {
	Id       string
	PlotSeed string
	PlotDir  string
	PlotSize uint64
	// contains filtered or unexported fields
}

*一个Work对应着某一个需要P的目录; *一个Work由多个Task组成; * 每一个Work有一个work进度,由已完成任务及正在进行的任务共同构成; * 每一个Task代表一个即将进行或者正在进行的P盘操作。 *

func (*Work) CommitTask

func (work *Work) CommitTask(task *Task)

func (*Work) GetTask

func (work *Work) GetTask() (task *Task)

func (*Work) Init

func (work *Work) Init()

func (*Work) Progress

func (work *Work) Progress() uint

func (*Work) RollbackTask

func (work *Work) RollbackTask(task *Task)

type Worker

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

func NewWorker

func NewWorker(work *Work) (worker *Worker)

func (*Worker) IsWorking

func (w *Worker) IsWorking() bool

func (*Worker) Progress

func (w *Worker) Progress() (progress uint, plotsize uint64)

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

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