Documentation
¶
Index ¶
- Constants
- type RepUpdate
- type ReputationMap
- type ReputationTable
- func (table *ReputationTable) ContribRandomPeer() string
- func (table *ReputationTable) DecreaseContribRep(peer string)
- func (table *ReputationTable) DecreaseSigRep(peer string, confidence float32)
- func (table *ReputationTable) ForEachContribRep(callback func(string, float32))
- func (table *ReputationTable) ForEachSigRep(callback func(string, float32))
- func (table *ReputationTable) GetContribRep(peer string) (float32, bool)
- func (table *ReputationTable) GetContribUpdate() *RepUpdate
- func (table *ReputationTable) GetSigRep(peer string) (float32, bool)
- func (table *ReputationTable) GetSigUpdate() *RepUpdate
- func (table *ReputationTable) GetUpdate() *RepUpdate
- func (table *ReputationTable) IncreaseContribRep(peer string)
- func (table *ReputationTable) IncreaseSigRep(peer string, confidence float32)
- func (table *ReputationTable) InitContribRepForPeer(peer string)
- func (table *ReputationTable) InitSigRepForPeer(peer string)
- func (table *ReputationTable) Log()
- func (table *ReputationTable) MostReputablePeers(n uint) *ReputationTable
- func (table *ReputationTable) Reputation(peer string) (float32, bool)
- func (table *ReputationTable) UpdateReputations(update *RepUpdate, sender string)
Constants ¶
View Source
const CONTRIB_ALPHA float32 = 0.4
Contribution-based reputation
View Source
const CONTRIB_ONE_MINUS_ALPHA float32 = 1 - CONTRIB_ALPHA
View Source
const DEFAULT_REP_REQ_TIMER uint = 8
Reputation update requests
View Source
const INIT_REP float32 = 0.5
View Source
const MAX_REP float32 = 1
View Source
const MIN_REP float32 = 0
General
View Source
const REP_RANGE float32 = MAX_REP - MIN_REP
View Source
const REP_REQ_PEER_COUNT uint = 3
View Source
const SIG_DECREASE_LIMIT float32 = 0.8
View Source
const SIG_INCREASE_LIMIT float32 = 0.1
Signature-based reputation
View Source
const UPDATER_DECREASE_LIMIT float32 = 0.25
View Source
const UPDATE_WEIGHT_LIMIT float32 = 0.15
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepUpdate ¶
type RepUpdate struct { SigReps ReputationMap ContribReps ReputationMap }
*
- A reputation table update, holding either signature-
- based and/or contribution-based reputations.
type ReputationMap ¶
*
- A simple map associating reputations in the form of
- 32-bit floating point numbers to pointers to peers.
type ReputationTable ¶
type ReputationTable struct {
// contains filtered or unexported fields
}
*
- A data structure assotiating signature-based and
- contribution-based reputations to peers using
- ReputationMap fields.
func NewReputationTable ¶
func NewReputationTable(peerSet *common.PeerSet) *ReputationTable
*
- Returns a new empty reputation table.
func (*ReputationTable) ContribRandomPeer ¶
func (table *ReputationTable) ContribRandomPeer() string
func (*ReputationTable) DecreaseContribRep ¶
func (table *ReputationTable) DecreaseContribRep(peer string)
*
- Updates the contribution-based reputation of a
- given peer to which data was sent.
func (*ReputationTable) DecreaseSigRep ¶
func (table *ReputationTable) DecreaseSigRep(peer string, confidence float32)
func (*ReputationTable) ForEachContribRep ¶
func (table *ReputationTable) ForEachContribRep(callback func(string, float32))
*
- Performs an operation for each entry in the contribution-based
- reputation table. The operation is defined as a callback
- function that takes a peer and a reputation as parameters.
func (*ReputationTable) ForEachSigRep ¶
func (table *ReputationTable) ForEachSigRep(callback func(string, float32))
*
- Performs an operation for each entry in the signature-based
- reputation table. The operation is defined as a callback
- function that takes a peer and a reputation as parameters.
func (*ReputationTable) GetContribRep ¶
func (table *ReputationTable) GetContribRep(peer string) (float32, bool)
*
- Returns the contribution-based reputation of the given peer.
func (*ReputationTable) GetContribUpdate ¶
func (table *ReputationTable) GetContribUpdate() *RepUpdate
*
- Returns a new reputation update with the contribution-
- based reputations in this table.
func (*ReputationTable) GetSigRep ¶
func (table *ReputationTable) GetSigRep(peer string) (float32, bool)
*
- Returns the signature-based reputation of the given peer.
func (*ReputationTable) GetSigUpdate ¶
func (table *ReputationTable) GetSigUpdate() *RepUpdate
*
- Returns a new reputation update with the signature-
- based reputations in this table.
func (*ReputationTable) GetUpdate ¶
func (table *ReputationTable) GetUpdate() *RepUpdate
*
- Returns a new reputation update with the signature-
- based and contribution-based reputations in this table.
func (*ReputationTable) IncreaseContribRep ¶
func (table *ReputationTable) IncreaseContribRep(peer string)
*
- Updates the contribution-based reputation of a
- given peer from which data was received.
func (*ReputationTable) IncreaseSigRep ¶
func (table *ReputationTable) IncreaseSigRep(peer string, confidence float32)
func (*ReputationTable) InitContribRepForPeer ¶
func (table *ReputationTable) InitContribRepForPeer(peer string)
*
- Checks if the given peer has a contribution-based
- reputation and if it does not, initializes it.
func (*ReputationTable) InitSigRepForPeer ¶
func (table *ReputationTable) InitSigRepForPeer(peer string)
*
- Checks if the given peer has a signature-based
- reputation and if it does not, initializes it.
func (*ReputationTable) Log ¶
func (table *ReputationTable) Log()
func (*ReputationTable) MostReputablePeers ¶
func (table *ReputationTable) MostReputablePeers(n uint) *ReputationTable
*
- Returns a new reputation table with the n most "signature-
- reputabale" peers and the n most "contribution-reputable"
- peers in this table, for a given n.
func (*ReputationTable) Reputation ¶
func (table *ReputationTable) Reputation(peer string) (float32, bool)
*
- Returns the signature-based reputation of the given peer.
- Same as GetSigRep, for awot's ReputationTable interface compatibility.
func (*ReputationTable) UpdateReputations ¶
func (table *ReputationTable) UpdateReputations(update *RepUpdate, sender string)
*
- Updates the reputations in this table with the ones in
- the given reputation update weighted by the reputation
- of the updater in this table, and updates the updater's
- reputation based on the degree of similarity between
- their update and this table.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.