rpt

package
v0.2.8-doc Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RptHash

func RptHash(rpthash RptItems) (hash common.Hash)

Types

type CandidateService

type CandidateService interface {
	CandidatesOf(term uint64) ([]common.Address, error)
}

CandidateService provides methods to obtain all candidates from campaign contract

func NewCandidateService

func NewCandidateService(backend bind.ContractBackend) (CandidateService, error)

NewCandidateService creates a concrete candidate service instance.

type CandidateServiceImpl

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

CandidateServiceImpl is the default candidate list collector

func (*CandidateServiceImpl) CandidatesOf

func (rs *CandidateServiceImpl) CandidatesOf(term uint64) ([]common.Address, error)

CandidatesOf implements CandidateService

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 RptCollectorImpl2

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

RptCollectorImpl2 implements RptCollector

func NewRptCollectorImpl2

func NewRptCollectorImpl2(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl2

func (*RptCollectorImpl2) Alpha

func (rc *RptCollectorImpl2) Alpha(num uint64) int64

func (*RptCollectorImpl2) Beta

func (rc *RptCollectorImpl2) Beta(num uint64) int64

func (*RptCollectorImpl2) Gamma

func (rc *RptCollectorImpl2) Gamma(num uint64) int64

func (*RptCollectorImpl2) MaintenanceInfoOf

func (rc *RptCollectorImpl2) MaintenanceInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) MaintenanceValueOf

func (rc *RptCollectorImpl2) MaintenanceValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) Omega

func (rc *RptCollectorImpl2) Omega(num uint64) int64

func (*RptCollectorImpl2) ProxyInfoOf

func (rc *RptCollectorImpl2) ProxyInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) ProxyValueOf

func (rc *RptCollectorImpl2) ProxyValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) Psi

func (rc *RptCollectorImpl2) Psi(num uint64) int64

func (*RptCollectorImpl2) RankInfoOf

func (rc *RptCollectorImpl2) RankInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) RankValueOf

func (rc *RptCollectorImpl2) RankValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) RptOf

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

func (*RptCollectorImpl2) TxsInfoOf

func (rc *RptCollectorImpl2) TxsInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) TxsValueOf

func (rc *RptCollectorImpl2) TxsValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) UploadInfoOf

func (rc *RptCollectorImpl2) UploadInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) UploadValueOf

func (rc *RptCollectorImpl2) UploadValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl2) WindowSize

func (rc *RptCollectorImpl2) WindowSize(num uint64) int

type RptCollectorImpl3

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

RptCollectorImpl3 implements RptCollector

func NewRptCollectorImpl3

func NewRptCollectorImpl3(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl3

func (*RptCollectorImpl3) Alpha

func (rc *RptCollectorImpl3) Alpha(num uint64) int64

func (*RptCollectorImpl3) Beta

func (rc *RptCollectorImpl3) Beta(num uint64) int64

func (*RptCollectorImpl3) Gamma

func (rc *RptCollectorImpl3) Gamma(num uint64) int64

func (*RptCollectorImpl3) MaintenanceInfoOf

func (rc *RptCollectorImpl3) MaintenanceInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) MaintenanceValueOf

func (rc *RptCollectorImpl3) MaintenanceValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) Omega

func (rc *RptCollectorImpl3) Omega(num uint64) int64

func (*RptCollectorImpl3) ProxyInfoOf

func (rc *RptCollectorImpl3) ProxyInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) ProxyValueOf

func (rc *RptCollectorImpl3) ProxyValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) Psi

func (rc *RptCollectorImpl3) Psi(num uint64) int64

func (*RptCollectorImpl3) RankInfoOf

func (rc *RptCollectorImpl3) RankInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) RankValueOf

func (rc *RptCollectorImpl3) RankValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) RptOf

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

func (*RptCollectorImpl3) TxsInfoOf

func (rc *RptCollectorImpl3) TxsInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) TxsValueOf

func (rc *RptCollectorImpl3) TxsValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) UploadInfoOf

func (rc *RptCollectorImpl3) UploadInfoOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) UploadValueOf

func (rc *RptCollectorImpl3) UploadValueOf(addr common.Address, num uint64, windowSize int) int64

func (*RptCollectorImpl3) WindowSize

func (rc *RptCollectorImpl3) WindowSize(num uint64) int

type RptCollectorImpl4

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

RptCollectorImpl4 implements RptCollector

func NewRptCollectorImpl4

func NewRptCollectorImpl4(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl4

NewRptCollectorImpl4 creates an RptCollectorImpl4

func (*RptCollectorImpl4) Alpha

func (rc *RptCollectorImpl4) Alpha(num uint64) int64

Alpha returns the coefficient of balance(coin age)

func (*RptCollectorImpl4) BalanceInfoOf

func (rc *RptCollectorImpl4) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

BalanceInfoOf minor

func (*RptCollectorImpl4) BalanceValueOf

func (rc *RptCollectorImpl4) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

BalanceValueOf returns Balance Value of reputation

func (*RptCollectorImpl4) Beta

func (rc *RptCollectorImpl4) Beta(num uint64) int64

Beta returns the coefficient of transaction count

func (*RptCollectorImpl4) Gamma

func (rc *RptCollectorImpl4) Gamma(num uint64) int64

Gamma returns the coefficient of Maintenance

func (*RptCollectorImpl4) MaintenanceInfoOf

func (rc *RptCollectorImpl4) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

MaintenanceInfoOf minor

func (*RptCollectorImpl4) MaintenanceValueOf

func (rc *RptCollectorImpl4) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

MaintenanceValueOf returns Chain Maintenance of reputation

func (*RptCollectorImpl4) Omega

func (rc *RptCollectorImpl4) Omega(num uint64) int64

Omega returns the coefficient of Proxy Information in Pdash

func (*RptCollectorImpl4) ProxyInfoOf

func (rc *RptCollectorImpl4) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

ProxyInfoOf minor

func (*RptCollectorImpl4) ProxyValueOf

func (rc *RptCollectorImpl4) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

ProxyValueOf returns Proxy Information of PDash of reputation

func (*RptCollectorImpl4) Psi

func (rc *RptCollectorImpl4) Psi(num uint64) int64

Psi returns the coefficient of File Contribution

func (*RptCollectorImpl4) RptOf

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

RptOf returns the reputation value of a given address among a batch addresses

func (*RptCollectorImpl4) TxsInfoOf

func (rc *RptCollectorImpl4) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

TxsInfoOf minor

func (*RptCollectorImpl4) TxsValueOf

func (rc *RptCollectorImpl4) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

TxsValueOf returns Transaction Count of reputation

func (*RptCollectorImpl4) UploadInfoOf

func (rc *RptCollectorImpl4) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

UploadInfoOf minor

func (*RptCollectorImpl4) UploadValueOf

func (rc *RptCollectorImpl4) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

UploadValueOf returns File Contribution of reputation

func (*RptCollectorImpl4) WindowSize

func (rc *RptCollectorImpl4) WindowSize(num uint64) int

WindowSize returns the windown size when calculating reputation value

type RptCollectorImpl5

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

RptCollectorImpl5 implements RptCollector

func NewRptCollectorImpl5

func NewRptCollectorImpl5(rptInstance *contracts.Rpt, chainBackend backend.ChainBackend) *RptCollectorImpl5

NewRptCollectorImpl5 creates an RptCollectorImpl5

func (*RptCollectorImpl5) Alpha

func (rc *RptCollectorImpl5) Alpha(num uint64) int64

Alpha returns the coefficient of balance(coin age)

func (*RptCollectorImpl5) BalanceInfoOf

func (rc *RptCollectorImpl5) BalanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

BalanceInfoOf minor

func (*RptCollectorImpl5) BalanceValueOf

func (rc *RptCollectorImpl5) BalanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

BalanceValueOf returns Balance Value of reputation

func (*RptCollectorImpl5) Beta

func (rc *RptCollectorImpl5) Beta(num uint64) int64

Beta returns the coefficient of transaction count

func (*RptCollectorImpl5) Gamma

func (rc *RptCollectorImpl5) Gamma(num uint64) int64

Gamma returns the coefficient of Maintenance

func (*RptCollectorImpl5) MaintenanceInfoOf

func (rc *RptCollectorImpl5) MaintenanceInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

MaintenanceInfoOf minor

func (*RptCollectorImpl5) MaintenanceValueOf

func (rc *RptCollectorImpl5) MaintenanceValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

MaintenanceValueOf returns Chain Maintenance of reputation

func (*RptCollectorImpl5) Omega

func (rc *RptCollectorImpl5) Omega(num uint64) int64

Omega returns the coefficient of Proxy Information in Pdash

func (*RptCollectorImpl5) ProxyInfoOf

func (rc *RptCollectorImpl5) ProxyInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

ProxyInfoOf minor

func (*RptCollectorImpl5) ProxyValueOf

func (rc *RptCollectorImpl5) ProxyValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

ProxyValueOf returns Proxy Information of PDash of reputation

func (*RptCollectorImpl5) Psi

func (rc *RptCollectorImpl5) Psi(num uint64) int64

Psi returns the coefficient of File Contribution

func (*RptCollectorImpl5) RptOf

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

RptOf returns the reputation value of a given address among a batch addresses

func (*RptCollectorImpl5) TxsInfoOf

func (rc *RptCollectorImpl5) TxsInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

TxsInfoOf minor

func (*RptCollectorImpl5) TxsValueOf

func (rc *RptCollectorImpl5) TxsValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

TxsValueOf returns Transaction Count of reputation

func (*RptCollectorImpl5) UploadInfoOf

func (rc *RptCollectorImpl5) UploadInfoOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

UploadInfoOf minor

func (*RptCollectorImpl5) UploadValueOf

func (rc *RptCollectorImpl5) UploadValueOf(addr common.Address, addrs []common.Address, num uint64, windowSize int) int64

UploadValueOf returns File Contribution of reputation

func (*RptCollectorImpl5) WindowSize

func (rc *RptCollectorImpl5) 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
	WindowSize() (uint64, error)
}

RptService provides methods to obtain all rpt related information from block txs and contracts.

func NewRptService

func NewRptService(backend backend.ClientBackend, rptContractAddr common.Address) (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) WindowSize

func (rs *RptServiceImpl) WindowSize() (uint64, error)

WindowSize reads windowsize from rpt contract

Jump to

Keyboard shortcuts

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