node

package
v0.0.0-...-6aff4a6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitBucketSize     = 1 << 24 //16M
	RechargePieceSize  = 1 << 22 //4M
	MaxLostRechargeReq = 2
	ConnectionBufSize  = 1 << 20
)
View Source
const (
	DefaultBaseDir = ".hop"
	WalletFile     = "wallet.json"
	DataBase       = "Receipts"
	LogFile        = "log.hop"
	PidFile        = "pid.hop"
	ConfFile       = "conf.hop"
)
View Source
const BUFFER_SIZE = 1 << 20

Variables

View Source
var CMDServicePort = "42017"
View Source
var (
	DBKeyMinerData = "%s_DB_KEY_MINER_DATA_FOR_POOL_%s_%s"
)
View Source
var (
	ErrNoPacketBalance = fmt.Errorf("need to recharge for this mienr")
)
View Source
var PathSetting = &PathConf{}
View Source
var SysConf = &Conf{}

Functions

func BaseDir

func BaseDir() string

func InitMinerNode

func InitMinerNode(auth, port string)

func QueryMinerData

func QueryMinerData(subAddr account.ID) (*eth.MinerData, error)

func WalletDir

func WalletDir(base string) string

Types

type Bucket

type Bucket struct {
	BID int
	sync.RWMutex
	Token int
	// contains filtered or unexported fields
}

func (*Bucket) ReadCount

func (b *Bucket) ReadCount(no int) error

Tips:: we just count the out put data

func (*Bucket) Recharge

func (b *Bucket) Recharge(no int)

func (*Bucket) WriteCount

func (b *Bucket) WriteCount(no int) error

type BucketManager

type BucketManager interface {
	RechargeBucket(*microchain.Receipt) error
}

type BucketMap

type BucketMap struct {
	sync.RWMutex
	Queue map[common.Address]*Bucket
}

func (*BucketMap) BucketTimer

func (bm *BucketMap) BucketTimer(sig chan struct{})

type Conf

type Conf struct {
	BAS string
	*com.EthereumConfig
}

type MicChain

type MicChain struct {
	Sign *microchain.ReceiptSync

	BucketManager BucketManager
	// contains filtered or unexported fields
}

func Chain

func Chain() *MicChain

func (*MicChain) KeepAlive

func (mc *MicChain) KeepAlive(sig chan struct{})

func (*MicChain) Sync

func (mc *MicChain) Sync(sig chan struct{})

type MinerWallet

type MinerWallet struct {
	account.Wallet
}

func WInst

func WInst() *MinerWallet

type Node

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

func SrvNode

func SrvNode() *Node

func (*Node) Mining

func (n *Node) Mining(sig chan struct{})

func (*Node) RechargeBucket

func (n *Node) RechargeBucket(r *microchain.Receipt) error

func (*Node) ShowUserBucket

func (n *Node) ShowUserBucket(user string) *Bucket

func (*Node) Stop

func (n *Node) Stop()

func (*Node) TestService

func (n *Node) TestService(sig chan struct{})

type PathConf

type PathConf struct {
	WalletPath string
	DBPath     string
	LogPath    string
	PidPath    string
	ConfPath   string
}

func (*PathConf) InitPath

func (pc *PathConf) InitPath()

func (*PathConf) String

func (pc *PathConf) String() string

type PingTest

type PingTest struct {
	PayLoad string
}

type ProbeReq

type ProbeReq struct {
	Target string
}

type SetupData

type SetupData struct {
	IV       network.Salt
	MainAddr common.Address
	SubAddr  account.ID
}

type SetupReq

type SetupReq struct {
	Sig []byte
	*SetupData
}

func (*SetupReq) String

func (sr *SetupReq) String() string

func (*SetupReq) Verify

func (sr *SetupReq) Verify() bool

Jump to

Keyboard shortcuts

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