service

package
v0.0.0-...-737687b Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Demo

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

TODO: Change the id to sha1(peerid|data|submits.lastid), so moocher can find it in resource updates later Demo implements the node.Service interface

func NewDemo

func NewDemo(params *DemoParams) (*Demo, error)

func (*Demo) APIs

func (self *Demo) APIs() []rpc.API

func (*Demo) IsWorker

func (self *Demo) IsWorker() bool

func (*Demo) Protocol

func (self *Demo) Protocol() *p2p.Protocol

func (*Demo) Protocols

func (self *Demo) Protocols() (protos []p2p.Protocol)

func (*Demo) Run

func (self *Demo) Run(p *protocols.Peer) error

The protocol code provides Hook to run when protocol starts on a peer

func (*Demo) Spec

func (self *Demo) Spec() *protocols.Spec

func (*Demo) Start

func (self *Demo) Start(srv *p2p.Server) error

func (*Demo) Stop

func (self *Demo) Stop() error

type DemoAPI

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

func (*DemoAPI) SetDifficulty

func (self *DemoAPI) SetDifficulty(d uint8) error

func (*DemoAPI) Stop

func (self *DemoAPI) Stop() error

func (*DemoAPI) Submit

func (self *DemoAPI) Submit(data []byte, difficulty uint8) (protocol.ID, error)

type DemoParams

type DemoParams struct {
	Id                  []byte
	MaxDifficulty       uint8
	MaxJobs             int
	MaxTimePerJob       time.Duration
	SubmitDelay         time.Duration
	SubmitDataSize      int
	MaxSubmitDifficulty uint8
	MinSubmitDifficulty uint8
	ResultSink          ResultSinkFunc
	Save                SaveFunc
}

func NewDemoParams

func NewDemoParams(sinkFunc ResultSinkFunc, saveFunc SaveFunc) *DemoParams

type ResultSinkFunc

type ResultSinkFunc func(data interface{})

type SaveFunc

type SaveFunc func(nid []byte, mid protocol.ID, difficulty uint8, data []byte, nonce []byte, hash []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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