Documentation ¶
Index ¶
- func PctCount(pct int, total int) 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 RptCollector ¶ added in v0.3.1
RptCollector collects rpts infos of a given candidate
type RptCollectorImpl ¶ added in v0.3.1
type RptCollectorImpl struct {
// contains filtered or unexported fields
}
RptCollectorImpl implements RptCollector
func NewRptCollectorImpl6 ¶ added in v0.3.1
func NewRptCollectorImpl6(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl
NewRptCollectorImpl6 creates an RptCollectorImpl6
func (*RptCollectorImpl) Alpha ¶ added in v0.3.1
func (rc *RptCollectorImpl) Alpha(num uint64) int64
Alpha returns the coefficient of balance(coin age)
func (*RptCollectorImpl) BalanceInfoOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceInfoOf minor
func (*RptCollectorImpl) BalanceValueOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
BalanceValueOf returns Balance Value of reputation
func (*RptCollectorImpl) Beta ¶ added in v0.3.1
func (rc *RptCollectorImpl) Beta(num uint64) int64
Beta returns the coefficient of transaction count
func (*RptCollectorImpl) Gamma ¶ added in v0.3.1
func (rc *RptCollectorImpl) Gamma(num uint64) int64
Gamma returns the coefficient of Maintenance
func (*RptCollectorImpl) MaintenanceInfoOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceInfoOf minor
func (*RptCollectorImpl) MaintenanceValueOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
MaintenanceValueOf returns Chain Maintenance of reputation
func (*RptCollectorImpl) Omega ¶ added in v0.3.1
func (rc *RptCollectorImpl) Omega(num uint64) int64
Omega returns the coefficient of Proxy Information in Pdash
func (*RptCollectorImpl) ProxyInfoOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
ProxyInfoOf minor
func (*RptCollectorImpl) ProxyValueOf ¶ added in v0.3.1
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 ¶ added in v0.3.1
func (rc *RptCollectorImpl) Psi(num uint64) int64
Psi returns the coefficient of File Contribution
func (*RptCollectorImpl) RptOf ¶ added in v0.3.1
RptOf returns the reputation value of a given address among a batch addresses
func (*RptCollectorImpl) TxsInfoOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsInfoOf minor
func (*RptCollectorImpl) TxsValueOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
TxsValueOf returns Transaction Count of reputation
func (*RptCollectorImpl) UploadInfoOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadInfoOf minor
func (*RptCollectorImpl) UploadValueOf ¶ added in v0.3.1
func (rc *RptCollectorImpl) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64
UploadValueOf returns File Contribution of reputation
func (*RptCollectorImpl) WindowSize ¶ added in v0.3.1
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 ¶ added in v0.3.1
func (rs *RptServiceImpl) LowRptCount(total int) int
LowRptCount returns LowRptCount
func (*RptServiceImpl) LowRptPercentage ¶ added in v0.3.1
func (rs *RptServiceImpl) LowRptPercentage() (int, error)
LowRptPercentage returns low rpt percentage among all rpt list
func (*RptServiceImpl) LowRptSeats ¶ added in v0.3.1
func (rs *RptServiceImpl) LowRptSeats() (int, error)
LowRptSeats returns low rpt seats
func (*RptServiceImpl) TotalSeats ¶ added in v0.3.1
func (rs *RptServiceImpl) TotalSeats() (int, error)
TotalSeats returns total dynaimc seats