worker

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Unlicense Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const CountPerRound = 500

Variables

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)

Functions

This section is empty.

Types

type Counter

type Counter struct {
	C             atomic.Int32
	Algos         atomic.Value // []int32
	RoundsPerAlgo atomic.Int32
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(countPerRound int32) (c *Counter)

NewCounter returns an initialized algorithm rolling counter that ensures each miner does equal amounts of every algorithm

func (*Counter) GetAlgoVer

func (c *Counter) GetAlgoVer(height int32) (ver int32)

GetAlgoVer returns the next algo version based on the current configuration

type Worker

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

func New

func New(id string, quit qu.C, uuid uint64) (w *Worker, conn net.Conn)

New initialises the state for a worker, loading the work function handler that runs a round of processing between checking quit signal and work semaphore

func NewWithConnAndSemaphore

func NewWithConnAndSemaphore(id string, conn *stdconn.StdConn, quit qu.C, uuid uint64) *Worker

NewWithConnAndSemaphore is exposed to enable use an actual network connection while retaining the same RPC API to allow a worker to be configured to run on a bare metal system with a different launcher main

func (*Worker) NewJob

func (w *Worker) NewJob(j *templates.Message, reply *bool) (e error)

NewJob is a delivery of a new job for the worker, this makes the miner start mining from pause or pause, prepare the work and restart

func (*Worker) Pause

func (w *Worker) Pause(_ int, reply *bool) (e error)

Pause signals the worker to stop working, releases its semaphore and the worker is then idle

func (*Worker) SendPass

func (w *Worker) SendPass(pass []byte, reply *bool) (e error)

SendPass gives the encryption key configured in the kopach controller ( pod) configuration to allow workers to dispatch their solutions

func (*Worker) Stop

func (w *Worker) Stop(_ int, reply *bool) (e error)

Stop signals the worker to quit

Jump to

Keyboard shortcuts

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