stratum

package
v0.0.0-...-98dca7c Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Generated from https://github.com/streamrail/concurrent-map

Index

Constants

View Source
const (
	MaxReqSize = 10 * 1024
)

Variables

View Source
var SHARD_COUNT = 32

Functions

This section is empty.

Types

type BlockTemplate

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

type Endpoint

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

func NewEndpoint

func NewEndpoint(cfg *pool.Port) *Endpoint

func (*Endpoint) Listen

func (e *Endpoint) Listen(s *StratumServer)

type ErrorReply

type ErrorReply struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type GetJobParams

type GetJobParams struct {
	Id string `json:"id"`
}

type JSONPushMessage

type JSONPushMessage struct {
	Version string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
}

type JSONRpcReq

type JSONRpcReq struct {
	Id     *json.RawMessage `json:"id"`
	Method string           `json:"method"`
	Params *json.RawMessage `json:"params"`
}

type JSONRpcResp

type JSONRpcResp struct {
	Id      *json.RawMessage `json:"id"`
	Version string           `json:"jsonrpc"`
	Result  interface{}      `json:"result"`
	Error   interface{}      `json:"error"`
}

type Job

type Job struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type JobReply

type JobReply struct {
	Id     string        `json:"id"`
	Job    *JobReplyData `json:"job"`
	Status string        `json:"status"`
}

type JobReplyData

type JobReplyData struct {
	Blob   string `json:"blob"`
	JobId  string `json:"job_id"`
	Target string `json:"target"`
}

type LoginParams

type LoginParams struct {
	Login string `json:"login"`
	Pass  string `json:"pass"`
	Agent string `json:"agent"`
}

type Miner

type Miner struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMiner

func NewMiner(id string, ip string) *Miner

type MinersMap

type MinersMap []*MinersMapShared

A "thread" safe map of type string:*Miner. To avoid lock bottlenecks this map is dived to several (SHARD_COUNT) map shards.

func NewMinersMap

func NewMinersMap() MinersMap

Creates a new concurrent map.

func (MinersMap) Count

func (m MinersMap) Count() int

Returns the number of elements within the map.

func (MinersMap) Get

func (m MinersMap) Get(key string) (*Miner, bool)

Retrieves an element from map under given key.

func (MinersMap) GetShard

func (m MinersMap) GetShard(key string) *MinersMapShared

Returns shard under given key

func (*MinersMap) Has

func (m *MinersMap) Has(key string) bool

Looks up an item under specified key

func (*MinersMap) IsEmpty

func (m *MinersMap) IsEmpty() bool

Checks if map is empty.

func (MinersMap) Iter

func (m MinersMap) Iter() <-chan Tuple

Returns an iterator which could be used in a for range loop.

func (MinersMap) IterBuffered

func (m MinersMap) IterBuffered() <-chan Tuple

Returns a buffered iterator which could be used in a for range loop.

func (*MinersMap) Remove

func (m *MinersMap) Remove(key string)

Removes an element from the map.

func (*MinersMap) Set

func (m *MinersMap) Set(key string, value *Miner)

Sets the given value under the specified key.

type MinersMapShared

type MinersMapShared struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

type Session

type Session struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type StatusReply

type StatusReply struct {
	Status string `json:"status"`
}

type StratumServer

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

func NewStratum

func NewStratum(cfg *pool.Config) *StratumServer

func (*StratumServer) Listen

func (s *StratumServer) Listen()

func (*StratumServer) StatsIndex

func (s *StratumServer) StatsIndex(w http.ResponseWriter, r *http.Request)

type SubmitParams

type SubmitParams struct {
	Id     string `json:"id"`
	JobId  string `json:"job_id"`
	Nonce  string `json:"nonce"`
	Result string `json:"result"`
}

type Tuple

type Tuple struct {
	Key string
	Val *Miner
}

Used by the Iter & IterBuffered functions to wrap two variables together over a channel,

Jump to

Keyboard shortcuts

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