Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateCpu(sender common.Address, blockHash []byte, nonce uint64, difficulty uint64) bool
- func ValidateMemory(sender common.Address, blockHash []byte, nonce uint64, difficulty uint64) bool
- type AdmissionApiBackend
- func (b *AdmissionApiBackend) Abort()
- func (b *AdmissionApiBackend) AdmissionKey() *keystore.Key
- func (b *AdmissionApiBackend) Apis() []rpc.API
- func (b *AdmissionApiBackend) Campaign(terms uint64) error
- func (b *AdmissionApiBackend) CheckNetworkStatus() bool
- func (b *AdmissionApiBackend) FundForRNode() error
- func (b *AdmissionApiBackend) GetResult() map[string]Result
- func (b *AdmissionApiBackend) GetStatus() (workStatus, error)
- func (b *AdmissionApiBackend) IgnoreNetworkCheck()
- func (b *AdmissionApiBackend) IsRNode() (bool, error)
- func (b *AdmissionApiBackend) RegisterInProcHandler(localRPCServer *rpc.Server)
- func (b *AdmissionApiBackend) SetAdmissionKey(key *keystore.Key)
- func (b *AdmissionApiBackend) SetContractBackend(contractBackend contracts.Backend)
- type AdmissionControl
- func (ac *AdmissionControl) Abort()
- func (ac *AdmissionControl) Campaign(terms uint64) error
- func (ac *AdmissionControl) CheckNetworkStatus() bool
- func (ac *AdmissionControl) DoneCh() <-chan interface{}
- func (ac *AdmissionControl) FundForRNode() error
- func (ac *AdmissionControl) GetResult() map[string]Result
- func (ac *AdmissionControl) GetStatus() (workStatus, error)
- func (ac *AdmissionControl) IgnoreNetworkCheck()
- func (ac *AdmissionControl) IsRNode() (bool, error)
- func (ac *AdmissionControl) SetAdmissionKey(key *keystore.Key)
- func (ac *AdmissionControl) SetSimulateBackend(contractBackend contracts.Backend)
- type ApiBackend
- type ProofWork
- type Result
Constants ¶
const ( // AcIdle status done. AcIdle workStatus = iota + 1 // AcRunning status running. AcRunning Cpu = "cpu" Memory = "memory" )
Variables ¶
var ( ErrPowAbort = errors.New("proof work aborts") ErrPowTimeout = errors.New("proof work timeout") )
Functions ¶
func ValidateCpu ¶
Types ¶
type AdmissionApiBackend ¶
type AdmissionApiBackend struct {
// contains filtered or unexported fields
}
func (*AdmissionApiBackend) Abort ¶
func (b *AdmissionApiBackend) Abort()
func (*AdmissionApiBackend) AdmissionKey ¶
func (b *AdmissionApiBackend) AdmissionKey() *keystore.Key
func (*AdmissionApiBackend) Apis ¶
func (b *AdmissionApiBackend) Apis() []rpc.API
APIs returns the collection of RPC services the admission package offers.
func (*AdmissionApiBackend) Campaign ¶
func (b *AdmissionApiBackend) Campaign(terms uint64) error
func (*AdmissionApiBackend) CheckNetworkStatus ¶
func (b *AdmissionApiBackend) CheckNetworkStatus() bool
func (*AdmissionApiBackend) FundForRNode ¶
func (b *AdmissionApiBackend) FundForRNode() error
func (*AdmissionApiBackend) GetResult ¶
func (b *AdmissionApiBackend) GetResult() map[string]Result
func (*AdmissionApiBackend) GetStatus ¶
func (b *AdmissionApiBackend) GetStatus() (workStatus, error)
func (*AdmissionApiBackend) IgnoreNetworkCheck ¶
func (b *AdmissionApiBackend) IgnoreNetworkCheck()
func (*AdmissionApiBackend) IsRNode ¶
func (b *AdmissionApiBackend) IsRNode() (bool, error)
func (*AdmissionApiBackend) RegisterInProcHandler ¶
func (b *AdmissionApiBackend) RegisterInProcHandler(localRPCServer *rpc.Server)
RegisterInProcHandler registers the rpc.Server, handles RPC request to process the API requests in process
func (*AdmissionApiBackend) SetAdmissionKey ¶
func (b *AdmissionApiBackend) SetAdmissionKey(key *keystore.Key)
func (*AdmissionApiBackend) SetContractBackend ¶
func (b *AdmissionApiBackend) SetContractBackend(contractBackend contracts.Backend)
type AdmissionControl ¶
type AdmissionControl struct {
// contains filtered or unexported fields
}
AdmissionControl implements admission control functionality.
func NewAdmissionControl ¶
func NewAdmissionControl(chain consensus.ChainReader, address common.Address, admissionContractAddr common.Address, campaignContractAddr common.Address, rNodeContractAddr common.Address, networkContractAddr common.Address) *AdmissionControl
NewAdmissionControl returns a new Control instance.
func (*AdmissionControl) Abort ¶
func (ac *AdmissionControl) Abort()
Abort cancels all the proof work associated to the workType.
func (*AdmissionControl) Campaign ¶
func (ac *AdmissionControl) Campaign(terms uint64) error
Campaign starts running all the proof work to generate the campaign information and waits all proof work done, send msg
func (*AdmissionControl) CheckNetworkStatus ¶
func (ac *AdmissionControl) CheckNetworkStatus() bool
func (*AdmissionControl) DoneCh ¶
func (ac *AdmissionControl) DoneCh() <-chan interface{}
func (*AdmissionControl) FundForRNode ¶
func (ac *AdmissionControl) FundForRNode() error
func (*AdmissionControl) GetResult ¶
func (ac *AdmissionControl) GetResult() map[string]Result
GetResult gets all work proofInfo
func (*AdmissionControl) GetStatus ¶
func (ac *AdmissionControl) GetStatus() (workStatus, error)
GetStatus gets status of campaign
func (*AdmissionControl) IgnoreNetworkCheck ¶
func (ac *AdmissionControl) IgnoreNetworkCheck()
func (*AdmissionControl) IsRNode ¶
func (ac *AdmissionControl) IsRNode() (bool, error)
IsRNode returns true or false indicating whether the node is RNode which is able to participate campaign
func (*AdmissionControl) SetAdmissionKey ¶
func (ac *AdmissionControl) SetAdmissionKey(key *keystore.Key)
SetAdmissionKey sets the key for admission control to participate campaign
func (*AdmissionControl) SetSimulateBackend ¶
func (ac *AdmissionControl) SetSimulateBackend(contractBackend contracts.Backend)
type ApiBackend ¶
type ApiBackend interface { // APIs returns the collection of RPC services the admission package offers. Apis() []rpc.API // IsRNode returns true or false indicate whether the node is RNode IsRNode() (bool, error) // FundForRNode sends money to reward contract to become RNode FundForRNode() error // Campaign starts running all the proof work to generate the campaign information and waits all proof work done, send msg Campaign(times uint64) error // Abort cancels all the proof work associated to the workType. Abort() // GetStatus gets status of campaign GetStatus() (workStatus, error) // getResult returns the work proof result GetResult() map[string]Result // SetAdmissionKey sets the key for admission control to participate campaign SetAdmissionKey(key *keystore.Key) // AdmissionKey returns keystore key AdmissionKey() *keystore.Key // RegisterInProcHandler registers the rpc.Server, handles RPC request to process the API requests in process RegisterInProcHandler(localRPCServer *rpc.Server) SetContractBackend(contractBackend contracts.Backend) // IgnoreNetworkCheck tells ac backend to ignore network status check IgnoreNetworkCheck() }
ApiBackend interface provides the common JSON-RPC API.