rpt

package
v0.3.0-doc Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PctCount added in v0.3.1

func PctCount(pct int, total int) int

PctCount calcs #pct percentage of #total

Types

type Rpt

type Rpt struct {
	Address common.Address
	Rpt     int64
}

Rpt defines the name and reputation pair.

type RptCollector added in v0.3.1

type RptCollector interface {
	RptOf(addr common.Address, addrs []common.Address, num uint64) Rpt
}

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

func (rc *RptCollectorImpl) RptOf(addr common.Address, addrs []common.Address, num uint64) Rpt

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 RptItems

type RptItems struct {
	Nodeaddress common.Address
	Key         uint64
}

type RptList

type RptList []Rpt

RptList is an array of Rpt.

func (*RptList) FormatString

func (r *RptList) FormatString() string

func (RptList) Len

func (a RptList) Len() int

This is used for sorting.

func (RptList) Less

func (a RptList) Less(i, j int) bool

func (RptList) Swap

func (a RptList) Swap(i, j int)

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

Jump to

Keyboard shortcuts

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