reputation

package
v1.25.1-0...-2fdc35d Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrustsToV2

func TrustsToV2(xs []*Trust) (res []*reputation.Trust)

TrustsToV2 converts slice of Trust's to slice of NeoFS API v2 reputation.Trust message structures.

Types

type GlobalTrust

type GlobalTrust reputation.GlobalTrust

GlobalTrust represents peer's global trust compatible with NeoFS API v2.

func GlobalTrustFromV2

func GlobalTrustFromV2(t *reputation.GlobalTrust) *GlobalTrust

GlobalTrustFromV2 converts NeoFS API v2 reputation.GlobalTrust message structure to GlobalTrust.

Nil reputation.GlobalTrust converts to nil.

func NewGlobalTrust

func NewGlobalTrust() *GlobalTrust

NewGlobalTrust creates and returns blank GlobalTrust.

Defaults:

  • version: pkg.SDKVersion();
  • manager: nil;
  • trust: nil.

func (*GlobalTrust) Manager

func (x *GlobalTrust) Manager() *PeerID

Manager returns node manager ID.

func (*GlobalTrust) Marshal

func (x *GlobalTrust) Marshal(b ...[]byte) ([]byte, error)

Marshal marshals GlobalTrust into a protobuf binary form.

Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.

func (*GlobalTrust) MarshalJSON

func (x *GlobalTrust) MarshalJSON() ([]byte, error)

MarshalJSON encodes GlobalTrust to protobuf JSON format.

func (*GlobalTrust) SetManager

func (x *GlobalTrust) SetManager(id *PeerID)

SetManager sets node manager ID.

func (*GlobalTrust) SetTrust

func (x *GlobalTrust) SetTrust(trust *Trust)

SetTrust sets global trust value.

func (*GlobalTrust) SetVersion

func (x *GlobalTrust) SetVersion(version *pkg.Version)

SetVersion sets GlobalTrust's protocol version.

func (*GlobalTrust) SignECDSA

func (x *GlobalTrust) SignECDSA(key ecdsa.PrivateKey) error

SignECDSA signs global trust value with ECDSA key.

Key mus not be nil.

func (*GlobalTrust) ToV2

func (x *GlobalTrust) ToV2() *reputation.GlobalTrust

ToV2 converts GlobalTrust to NeoFS API v2 reputation.GlobalTrust message structure.

Nil GlobalTrust converts to nil.

func (*GlobalTrust) Trust

func (x *GlobalTrust) Trust() *Trust

Trust returns global trust value.

func (*GlobalTrust) Unmarshal

func (x *GlobalTrust) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of GlobalTrust.

func (*GlobalTrust) UnmarshalJSON

func (x *GlobalTrust) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes GlobalTrust from protobuf JSON format.

func (*GlobalTrust) VerifySignature

func (x *GlobalTrust) VerifySignature() error

VerifySignature verifies global trust signature.

func (*GlobalTrust) Version

func (x *GlobalTrust) Version() *pkg.Version

Version returns GlobalTrust's protocol version.

type PeerID

type PeerID reputation.PeerID

PeerID represents peer ID compatible with NeoFS API v2.

func NewPeerID

func NewPeerID() *PeerID

NewPeerID creates and returns blank PeerID.

Defaults:

  • publicKey: nil.

func PeerIDFromV2

func PeerIDFromV2(id *reputation.PeerID) *PeerID

PeerIDFromV2 converts NeoFS API v2 reputation.PeerID message to PeerID.

Nil reputation.PeerID converts to nil.

func (*PeerID) Equal

func (x *PeerID) Equal(x2 *PeerID) bool

Equal returns true if identifiers are identical.

func (*PeerID) Marshal

func (x *PeerID) Marshal(b ...[]byte) ([]byte, error)

Marshal marshals PeerID into a protobuf binary form.

Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.

func (*PeerID) MarshalJSON

func (x *PeerID) MarshalJSON() ([]byte, error)

MarshalJSON encodes PeerID to protobuf JSON format.

func (*PeerID) Parse

func (x *PeerID) Parse(s string) error

Parse parses PeerID from base58 string.

func (*PeerID) SetPublicKey

func (x *PeerID) SetPublicKey(v []byte)

SetPublicKey sets peer ID as a compressed public key.

func (*PeerID) String

func (x *PeerID) String() string

String returns base58 string representation of PeerID.

func (*PeerID) ToV2

func (x *PeerID) ToV2() *reputation.PeerID

ToV2 converts PeerID to NeoFS API v2 reputation.PeerID message.

Nil PeerID converts to nil.

func (*PeerID) Unmarshal

func (x *PeerID) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of PeerID.

func (*PeerID) UnmarshalJSON

func (x *PeerID) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes PeerID from protobuf JSON format.

type PeerToPeerTrust

type PeerToPeerTrust reputation.PeerToPeerTrust

PeerToPeerTrust represents directed peer-to-peer trust compatible with NeoFS API v2.

func NewPeerToPeerTrust

func NewPeerToPeerTrust() *PeerToPeerTrust

NewPeerToPeerTrust creates and returns blank PeerToPeerTrust.

Defaults:

  • trusting: nil;
  • trust: nil.

func PeerToPeerTrustFromV2

func PeerToPeerTrustFromV2(t *reputation.PeerToPeerTrust) *PeerToPeerTrust

PeerToPeerTrustFromV2 converts NeoFS API v2 reputation.PeerToPeerTrust message structure to PeerToPeerTrust.

Nil reputation.PeerToPeerTrust converts to nil.

func (*PeerToPeerTrust) Marshal

func (x *PeerToPeerTrust) Marshal(b ...[]byte) ([]byte, error)

Marshal marshals PeerToPeerTrust into a protobuf binary form.

Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.

func (*PeerToPeerTrust) MarshalJSON

func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error)

MarshalJSON encodes PeerToPeerTrust to protobuf JSON format.

func (*PeerToPeerTrust) SetTrust

func (x *PeerToPeerTrust) SetTrust(t *Trust)

SetTrust sets trust value of the trusting peer to the trusted one.

func (*PeerToPeerTrust) SetTrustingPeer

func (x *PeerToPeerTrust) SetTrustingPeer(id *PeerID)

SetTrustingPeer sets trusting peer ID.

func (*PeerToPeerTrust) ToV2

ToV2 converts PeerToPeerTrust to NeoFS API v2 reputation.PeerToPeerTrust message structure.

Nil PeerToPeerTrust converts to nil.

func (*PeerToPeerTrust) Trust

func (x *PeerToPeerTrust) Trust() *Trust

Trust returns trust value of the trusting peer to the trusted one.

func (*PeerToPeerTrust) TrustingPeer

func (x *PeerToPeerTrust) TrustingPeer() *PeerID

TrustingPeer returns trusting peer ID.

func (*PeerToPeerTrust) Unmarshal

func (x *PeerToPeerTrust) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of PeerToPeerTrust.

func (*PeerToPeerTrust) UnmarshalJSON

func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes PeerToPeerTrust from protobuf JSON format.

type Trust

type Trust reputation.Trust

Trust represents peer's trust compatible with NeoFS API v2.

func NewTrust

func NewTrust() *Trust

NewTrust creates and returns blank Trust.

Defaults:

  • value: 0;
  • PeerID: nil.

func TrustFromV2

func TrustFromV2(t *reputation.Trust) *Trust

TrustFromV2 converts NeoFS API v2 reputation.Trust message structure to Trust.

Nil reputation.Trust converts to nil.

func (*Trust) Marshal

func (x *Trust) Marshal(b ...[]byte) ([]byte, error)

Marshal marshals Trust into a protobuf binary form.

Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.

func (*Trust) MarshalJSON

func (x *Trust) MarshalJSON() ([]byte, error)

MarshalJSON encodes Trust to protobuf JSON format.

func (*Trust) Peer

func (x *Trust) Peer() *PeerID

Peer returns trusted peer ID.

func (*Trust) SetPeer

func (x *Trust) SetPeer(id *PeerID)

SetPeer sets trusted peer ID.

func (*Trust) SetValue

func (x *Trust) SetValue(val float64)

SetValue sets trust value.

func (*Trust) ToV2

func (x *Trust) ToV2() *reputation.Trust

ToV2 converts Trust to NeoFS API v2 reputation.Trust message structure.

Nil Trust converts to nil.

func (*Trust) Unmarshal

func (x *Trust) Unmarshal(data []byte) error

Unmarshal unmarshals protobuf binary representation of Trust.

func (*Trust) UnmarshalJSON

func (x *Trust) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Trust from protobuf JSON format.

func (*Trust) Value

func (x *Trust) Value() float64

Value returns trust value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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