clients

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: BSD-2-Clause Imports: 0 Imported by: 0

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 sentient 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 {
	//GetHeaderForWork providers a header to mine on
	// the deprecationChannel is closed when the job should be abandoned
	GetHeaderForWork() (target []byte, 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 sentient client or pool client should implement for miners to be able to report solved headers

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