reputation

package
v0.0.0-...-79ba347 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TrustOne is a trust value equal to one.
	TrustOne = TrustValue(1)

	// TrustZero is a trust value equal to zero.
	TrustZero = TrustValue(0)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Trust

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

Trust represents peer's trust (reputation).

func (Trust) Peer

func (t Trust) Peer() reputation.PeerID

Peer returns trusted peer ID.

func (*Trust) SetPeer

func (t *Trust) SetPeer(id reputation.PeerID)

SetPeer sets trusted peer ID.

func (*Trust) SetTrustingPeer

func (t *Trust) SetTrustingPeer(id reputation.PeerID)

SetTrustingPeer sets trusting peer ID.

func (*Trust) SetValue

func (t *Trust) SetValue(val TrustValue)

SetValue sets peer's trust value.

func (Trust) TrustingPeer

func (t Trust) TrustingPeer() reputation.PeerID

TrustingPeer returns trusting peer ID.

func (Trust) Value

func (t Trust) Value() TrustValue

Value returns peer's trust value.

type TrustHandler

type TrustHandler func(Trust) error

TrustHandler describes the signature of the reputation.Trust value handling function.

Termination of processing without failures is usually signaled with a zero error, while a specific value may describe the reason for failure.

type TrustValue

type TrustValue float64

TrustValue represents the numeric value of the node's trust.

func TrustValueFromFloat64

func TrustValueFromFloat64(v float64) TrustValue

TrustValueFromFloat64 converts float64 to TrustValue.

func TrustValueFromInt

func TrustValueFromInt(v int) TrustValue

TrustValueFromInt converts int to TrustValue.

func (*TrustValue) Add

func (v *TrustValue) Add(v2 TrustValue)

Add adds v2 to v.

func (TrustValue) Div

func (v TrustValue) Div(v2 TrustValue) TrustValue

Div returns the result of dividing v by v2.

func (TrustValue) Float64

func (v TrustValue) Float64() float64

Float64 converts TrustValue to float64.

func (TrustValue) IsZero

func (v TrustValue) IsZero() bool

IsZero returns true if v equal to zero.

func (*TrustValue) Mul

func (v *TrustValue) Mul(v2 TrustValue)

Mul multiplies v by v2.

func (TrustValue) String

func (v TrustValue) String() string

Jump to

Keyboard shortcuts

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