forked from TrueCloudLab/frostfs-node
[#428] reputation: Define basic types
Define PeerID, TrustValue and Trust types and basic methods on them. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
518f375dfd
commit
eadb3204f0
2 changed files with 97 additions and 0 deletions
17
pkg/services/reputation/peer.go
Normal file
17
pkg/services/reputation/peer.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package reputation
|
||||
|
||||
const peerIDLength = 33
|
||||
|
||||
// PeerID represents identifier of reputation system participant.
|
||||
type PeerID [peerIDLength]byte
|
||||
|
||||
// Bytes converts PeerID to []byte.
|
||||
func (id PeerID) Bytes() []byte {
|
||||
return id[:]
|
||||
}
|
||||
|
||||
// PeerIDFromBytes restores PeerID from []byte.
|
||||
func PeerIDFromBytes(data []byte) (id PeerID) {
|
||||
copy(id[:], data)
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue