Documentation ¶
Overview ¶
Package clients provides some utilities and common code for specific client implementations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
BaseClient implements some common properties and functionality
func (*BaseClient) AddJobToDeprecate ¶
func (sc *BaseClient) AddJobToDeprecate(jobid string)
AddJobToDeprecate add the jobid to the list of jobs that should be deprecated when the times comes
func (*BaseClient) DeprecateOutstandingJobs ¶
func (sc *BaseClient) DeprecateOutstandingJobs()
DeprecateOutstandingJobs closes all deprecationChannels and removes them from the list This method is not threadsafe
func (*BaseClient) GetDeprecationChannel ¶
func (sc *BaseClient) GetDeprecationChannel(jobid string) chan bool
GetDeprecationChannel return the channel that will be closed when a job gets deprecated
func (*BaseClient) SetDeprecatedJobCall ¶
func (sc *BaseClient) SetDeprecatedJobCall(call DeprecatedJobCall)
SetDeprecatedJobCall sets the function to be called when the previous jobs should be abandoned
type Client ¶
type Client 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) }
Client defines the interface for a client towards a work provider
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 { //GetWork providers a header to mine on // the deprecationChannel is closed when the job should be abandoned GetWork() (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 Submit(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