powmgr

package
v0.0.0-...-ddd0786 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2016 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type PowManager

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

PowManager manages the calculation of proof-of-work in the pow queue. While it is running, when it receives a message that a new item has been added to the pow queue, it goes down the queue and runs the pow for every item in the queue, and then sends the completed item to the server.

func New

func New(pq *store.PowQueue,
	donePowFunc func(index uint64, user uint32, obj []byte),
	powFunc func(target uint64, hash []byte) uint64) *PowManager

New creates a new PowManager.

func (*PowManager) RunPow

func (pm *PowManager) RunPow(target uint64, user uint32, obj []byte) (uint64, error)

RunPow adds an object message with a target value for PoW to the end of the pow queue. It returns the index value of the stored element. If the PowManager is running, then a signal is sent to start running hashes immediately.

func (*PowManager) Start

func (pm *PowManager) Start()

Start starts the PowManager.

func (*PowManager) Stop

func (pm *PowManager) Stop()

Stop stops the PowManager

Jump to

Keyboard shortcuts

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