Documentation ¶
Index ¶
- func TrustsToV2(xs []*Trust) (res []*reputation.Trust)
- type GlobalTrust
- func (x *GlobalTrust) Manager() *PeerID
- func (x *GlobalTrust) Marshal(b ...[]byte) ([]byte, error)
- func (x *GlobalTrust) MarshalJSON() ([]byte, error)
- func (x *GlobalTrust) SetManager(id *PeerID)
- func (x *GlobalTrust) SetTrust(trust *Trust)
- func (x *GlobalTrust) SetVersion(version *pkg.Version)
- func (x *GlobalTrust) Sign(key *ecdsa.PrivateKey) error
- func (x *GlobalTrust) ToV2() *reputation.GlobalTrust
- func (x *GlobalTrust) Trust() *Trust
- func (x *GlobalTrust) Unmarshal(data []byte) error
- func (x *GlobalTrust) UnmarshalJSON(data []byte) error
- func (x *GlobalTrust) VerifySignature() error
- func (x *GlobalTrust) Version() *pkg.Version
- type PeerID
- func (x *PeerID) Equal(x2 *PeerID) bool
- func (x *PeerID) Marshal(b ...[]byte) ([]byte, error)
- func (x *PeerID) MarshalJSON() ([]byte, error)
- func (x *PeerID) Parse(s string) error
- func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte)
- func (x *PeerID) String() string
- func (x *PeerID) ToV2() *reputation.PeerID
- func (x *PeerID) Unmarshal(data []byte) error
- func (x *PeerID) UnmarshalJSON(data []byte) error
- type PeerToPeerTrust
- func (x *PeerToPeerTrust) Marshal(b ...[]byte) ([]byte, error)
- func (x *PeerToPeerTrust) MarshalJSON() ([]byte, error)
- func (x *PeerToPeerTrust) SetTrust(t *Trust)
- func (x *PeerToPeerTrust) SetTrustingPeer(id *PeerID)
- func (x *PeerToPeerTrust) ToV2() *reputation.PeerToPeerTrust
- func (x *PeerToPeerTrust) Trust() *Trust
- func (x *PeerToPeerTrust) TrustingPeer() *PeerID
- func (x *PeerToPeerTrust) Unmarshal(data []byte) error
- func (x *PeerToPeerTrust) UnmarshalJSON(data []byte) error
- type Trust
- func (x *Trust) Marshal(b ...[]byte) ([]byte, error)
- func (x *Trust) MarshalJSON() ([]byte, error)
- func (x *Trust) Peer() *PeerID
- func (x *Trust) SetPeer(id *PeerID)
- func (x *Trust) SetValue(val float64)
- func (x *Trust) ToV2() *reputation.Trust
- func (x *Trust) Unmarshal(data []byte) error
- func (x *Trust) UnmarshalJSON(data []byte) error
- func (x *Trust) Value() float64
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) Sign ¶
func (x *GlobalTrust) Sign(key *ecdsa.PrivateKey) error
Sign signs global trust value with key.
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) 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) Marshal ¶
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 ¶
MarshalJSON encodes PeerID to protobuf JSON format.
func (*PeerID) SetPublicKey ¶
func (x *PeerID) SetPublicKey(v [crypto.PublicKeyCompressedSize]byte)
SetPublicKey sets peer ID as a compressed public key.
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) UnmarshalJSON ¶
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 ¶
func (x *PeerToPeerTrust) ToV2() *reputation.PeerToPeerTrust
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 ¶
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 ¶
MarshalJSON encodes Trust to protobuf JSON format.
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) UnmarshalJSON ¶
UnmarshalJSON decodes Trust from protobuf JSON format.