Documentation
¶
Index ¶
- func PctCount(pct int, total int) int
- type CollectorImpl2
- func (rc *CollectorImpl2) Alpha(num uint64) int64
- func (rc *CollectorImpl2) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) Beta(num uint64) int64
- func (rc *CollectorImpl2) Gamma(num uint64) int64
- func (rc *CollectorImpl2) ImpeachPunishment(addr common.Address, addrs []common.Address, num uint64) float32
- func (rc *CollectorImpl2) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) Omega(num uint64) int64
- func (rc *CollectorImpl2) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) Psi(num uint64) int64
- func (rc *CollectorImpl2) RptOf(addr common.Address, addrs []common.Address, num uint64) Rpt
- func (rc *CollectorImpl2) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *CollectorImpl2) WindowSize(num uint64) int
- type Rpt
- type RptCollector
- type RptCollectorImpl
- func (rc *RptCollectorImpl) Alpha(num uint64) int64
- func (rc *RptCollectorImpl) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) Beta(num uint64) int64
- func (rc *RptCollectorImpl) Gamma(num uint64) int64
- func (rc *RptCollectorImpl) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) Omega(num uint64) int64
- func (rc *RptCollectorImpl) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) Psi(num uint64) int64
- func (rc *RptCollectorImpl) RptOf(addr common.Address, addrs []common.Address, num uint64) Rpt
- func (rc *RptCollectorImpl) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
- func (rc *RptCollectorImpl) WindowSize(num uint64) int
- type RptItems
- type RptList
- type RptService
- type RptServiceImpl
- func (rs *RptServiceImpl) CalcRptInfo(address common.Address, addresses []common.Address, number uint64) Rpt
- func (rs *RptServiceImpl) CalcRptInfoList(addresses []common.Address, number uint64) RptList
- func (rs *RptServiceImpl) LowRptCount(total int) int
- func (rs *RptServiceImpl) LowRptPercentage() (int, error)
- func (rs *RptServiceImpl) LowRptSeats() (int, error)
- func (rs *RptServiceImpl) TotalSeats() (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CollectorImpl2 ¶
type CollectorImpl2 struct {
// contains filtered or unexported fields
}
CollectorImpl2 implements RptCollector
func NewCollectorImpl2 ¶
func NewCollectorImpl2(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *CollectorImpl2
NewCollectorImpl2 creates an CollectorImpl2
func (*CollectorImpl2) Alpha ¶
func (rc *CollectorImpl2) Alpha(num uint64) int64
Alpha returns the coefficient of balance(coin age)
func (*CollectorImpl2) BalanceInfoOf ¶
func (rc *CollectorImpl2) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceInfoOf minor
func (*CollectorImpl2) BalanceValueOf ¶
func (rc *CollectorImpl2) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceValueOf returns Balance Value of reputation
func (*CollectorImpl2) Beta ¶
func (rc *CollectorImpl2) Beta(num uint64) int64
Beta returns the coefficient of transaction count
func (*CollectorImpl2) Gamma ¶
func (rc *CollectorImpl2) Gamma(num uint64) int64
Gamma returns the coefficient of Maintenance
func (*CollectorImpl2) ImpeachPunishment ¶
func (rc *CollectorImpl2) ImpeachPunishment(addr common.Address, addrs []common.Address, num uint64) float32
ImpeachPunishment returns the decline ratio according to the impeachment history of the rnode. the returned values are in [0., 1/n, 2/n, ..., (n-1)/n, 1] where n equals to `maxAllowedImpeachedBlocks`.
func (*CollectorImpl2) MaintenanceInfoOf ¶
func (rc *CollectorImpl2) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceInfoOf minor
func (*CollectorImpl2) MaintenanceValueOf ¶
func (rc *CollectorImpl2) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceValueOf returns Chain Maintenance of reputation
func (*CollectorImpl2) Omega ¶
func (rc *CollectorImpl2) Omega(num uint64) int64
Omega returns the coefficient of Proxy Information in Pdash
func (*CollectorImpl2) ProxyInfoOf ¶
func (rc *CollectorImpl2) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
ProxyInfoOf minor
func (*CollectorImpl2) ProxyValueOf ¶
func (rc *CollectorImpl2) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
ProxyValueOf returns Proxy Information of PDash of reputation
func (*CollectorImpl2) Psi ¶
func (rc *CollectorImpl2) Psi(num uint64) int64
Psi returns the coefficient of File Contribution
func (*CollectorImpl2) RptOf ¶
RptOf returns the reputation value of a given address among a batch addresses
func (*CollectorImpl2) TxsInfoOf ¶
func (rc *CollectorImpl2) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsInfoOf minor
func (*CollectorImpl2) TxsValueOf ¶
func (rc *CollectorImpl2) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsValueOf returns Transaction Count of reputation
func (*CollectorImpl2) UploadInfoOf ¶
func (rc *CollectorImpl2) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadInfoOf minor
func (*CollectorImpl2) UploadValueOf ¶
func (rc *CollectorImpl2) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadValueOf returns File Contribution of reputation
func (*CollectorImpl2) WindowSize ¶
func (rc *CollectorImpl2) WindowSize(num uint64) int
WindowSize returns the windown size when calculating reputation value
type RptCollector ¶
RptCollector collects rpts infos of a given candidate
type RptCollectorImpl ¶
type RptCollectorImpl struct {
// contains filtered or unexported fields
}
RptCollectorImpl implements RptCollector
func NewRptCollectorImpl ¶
func NewRptCollectorImpl(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl
NewRptCollectorImpl creates an RptCollectorImpl6
func (*RptCollectorImpl) Alpha ¶
func (rc *RptCollectorImpl) Alpha(num uint64) int64
Alpha returns the coefficient of balance(coin age)
func (*RptCollectorImpl) BalanceInfoOf ¶
func (rc *RptCollectorImpl) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceInfoOf minor
func (*RptCollectorImpl) BalanceValueOf ¶
func (rc *RptCollectorImpl) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceValueOf returns Balance Value of reputation
func (*RptCollectorImpl) Beta ¶
func (rc *RptCollectorImpl) Beta(num uint64) int64
Beta returns the coefficient of transaction count
func (*RptCollectorImpl) Gamma ¶
func (rc *RptCollectorImpl) Gamma(num uint64) int64
Gamma returns the coefficient of Maintenance
func (*RptCollectorImpl) MaintenanceInfoOf ¶
func (rc *RptCollectorImpl) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceInfoOf minor
func (*RptCollectorImpl) MaintenanceValueOf ¶
func (rc *RptCollectorImpl) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceValueOf returns Chain Maintenance of reputation
func (*RptCollectorImpl) Omega ¶
func (rc *RptCollectorImpl) Omega(num uint64) int64
Omega returns the coefficient of Proxy Information in Pdash
func (*RptCollectorImpl) ProxyInfoOf ¶
func (rc *RptCollectorImpl) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
ProxyInfoOf minor
func (*RptCollectorImpl) ProxyValueOf ¶
func (rc *RptCollectorImpl) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
ProxyValueOf returns Proxy Information of PDash of reputation
func (*RptCollectorImpl) Psi ¶
func (rc *RptCollectorImpl) Psi(num uint64) int64
Psi returns the coefficient of File Contribution
func (*RptCollectorImpl) RptOf ¶
RptOf returns the reputation value of a given address among a batch addresses
func (*RptCollectorImpl) TxsInfoOf ¶
func (rc *RptCollectorImpl) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsInfoOf minor
func (*RptCollectorImpl) TxsValueOf ¶
func (rc *RptCollectorImpl) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsValueOf returns Transaction Count of reputation
func (*RptCollectorImpl) UploadInfoOf ¶
func (rc *RptCollectorImpl) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadInfoOf minor
func (*RptCollectorImpl) UploadValueOf ¶
func (rc *RptCollectorImpl) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadValueOf returns File Contribution of reputation
func (*RptCollectorImpl) WindowSize ¶
func (rc *RptCollectorImpl) WindowSize(num uint64) int
WindowSize returns the windown size when calculating reputation value
type RptService ¶
type RptService interface { CalcRptInfoList(addresses []common.Address, number uint64) RptList CalcRptInfo(address common.Address, addresses []common.Address, blockNum uint64) Rpt TotalSeats() (int, error) LowRptSeats() (int, error) LowRptCount(total int) int }
RptService provides methods to obtain all rpt related information from block txs and contracts.
func NewRptService ¶
func NewRptService(contractAddr common.Address, backend backend.ClientBackend) (RptService, error)
NewRptService creates a concrete RPT service instance.
type RptServiceImpl ¶
type RptServiceImpl struct {
// contains filtered or unexported fields
}
BasicCollector is the default rpt collector
func (*RptServiceImpl) CalcRptInfo ¶
func (rs *RptServiceImpl) CalcRptInfo(address common.Address, addresses []common.Address, number uint64) Rpt
CalcRptInfo return the Rpt of the candidate address
func (*RptServiceImpl) CalcRptInfoList ¶
func (rs *RptServiceImpl) CalcRptInfoList(addresses []common.Address, number uint64) RptList
CalcRptInfoList returns reputation of the given addresses.
func (*RptServiceImpl) LowRptCount ¶
func (rs *RptServiceImpl) LowRptCount(total int) int
LowRptCount returns LowRptCount
func (*RptServiceImpl) LowRptPercentage ¶
func (rs *RptServiceImpl) LowRptPercentage() (int, error)
LowRptPercentage returns low rpt percentage among all rpt list
func (*RptServiceImpl) LowRptSeats ¶
func (rs *RptServiceImpl) LowRptSeats() (int, error)
LowRptSeats returns low rpt seats
func (*RptServiceImpl) TotalSeats ¶
func (rs *RptServiceImpl) TotalSeats() (int, error)
TotalSeats returns total dynamic seats