clients

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//HashSize is the length of a sia hash
	HashSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeprecatedJobCall

type DeprecatedJobCall func()

DeprecatedJobCall is a function that can be registered on a client to be executed when the server indicates that all previous jobs should be abandoned

type HeaderProvider

type HeaderProvider interface {
	//GetHeaderForWork providers a header to mine on
	// the deprecationChannel is closed when the job should be abandoned
	GetHeaderForWork() (target, header []byte, deprecationChannel chan bool, job interface{}, err error)
}

HeaderProvider supplies headers for a miner to mine on

type HeaderReporter

type HeaderReporter interface {
	//SubmitHeader reports a solved header
	SubmitHeader(header []byte, job interface{}) (err error)
}

HeaderReporter defines the required method a SIA client or pool client should implement for miners to be able to report solved headers

type SiaClient

type SiaClient interface {
	HeaderProvider
	HeaderReporter
	//Start connects to a sia daemon and starts supplying valid headers
	// It can be empty in case of a "getwork" implementation or maintain a tcp connection in case of stratum for example
	Start()
	//SetDeprecatedJobCall sets the function to be called when the previous jobs should be abandoned
	SetDeprecatedJobCall(call DeprecatedJobCall)
}

SiaClient is the Definition a client towards the sia network

func NewSiaClient

func NewSiaClient(connectionstring, pooluser string) (sc SiaClient)

NewSiaClient creates a new SiadClient given a '[stratum+tcp://]host:port' connectionstring

type SiaStratumClient

type SiaStratumClient struct {
	User string

	DeprecatedJobCall DeprecatedJobCall
	// contains filtered or unexported fields
}

SiaStratumClient is a sia client using the stratum protocol

func (*SiaStratumClient) GetHeaderForWork

func (sc *SiaStratumClient) GetHeaderForWork() (target, header []byte, deprecationChannel chan bool, job interface{}, err error)

GetHeaderForWork fetches new work from the SIA daemon

func (*SiaStratumClient) NeedNewHeader

func (sc *SiaStratumClient) NeedNewHeader(job interface{}) bool

NeedNewHeader returns true if a new job is present

func (*SiaStratumClient) SetDeprecatedJobCall

func (sc *SiaStratumClient) SetDeprecatedJobCall(call DeprecatedJobCall)

SetDeprecatedJobCall sets the function to be called when the previous jobs should be abandoned

func (*SiaStratumClient) Start

func (sc *SiaStratumClient) Start()

Start connects to the stratumserver and processes the notifications

func (*SiaStratumClient) SubmitHeader

func (sc *SiaStratumClient) SubmitHeader(header []byte, job interface{}) (err error)

SubmitHeader reports a solved header to the SIA daemon

type SiadClient

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

SiadClient is a simple client to a siad

func (*SiadClient) GetHeaderForWork

func (sc *SiadClient) GetHeaderForWork() (target []byte, header []byte, deprecationChannel chan bool, job interface{}, err error)

GetHeaderForWork fetches new work from the SIA daemon

func (*SiadClient) SetDeprecatedJobCall

func (sc *SiadClient) SetDeprecatedJobCall(call DeprecatedJobCall)

SetDeprecatedJobCall does nothing

func (*SiadClient) Start

func (sc *SiadClient) Start()

Start does nothing

func (*SiadClient) SubmitHeader

func (sc *SiadClient) SubmitHeader(header []byte, job interface{}) (err error)

SubmitHeader reports a solved header to the SIA daemon

type Target

type Target [HashSize]byte

Target declares what a solution should be smaller than to be accepted

Directories

Path Synopsis
Package stratum implements the basic stratum protocol.
Package stratum implements the basic stratum protocol.

Jump to

Keyboard shortcuts

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