forked from nspcc-dev/neofs-node
/
types.go
118 lines (99 loc) · 2.26 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package control
import (
"google.golang.org/protobuf/encoding/protojson"
)
// SetKey sets public key used for signing.
func (x *Signature) SetKey(v []byte) {
if x != nil {
x.Key = v
}
}
// SetSign sets binary signature.
func (x *Signature) SetSign(v []byte) {
if x != nil {
x.Sign = v
}
}
// SetKey sets key of the node attribute.
func (x *NodeInfo_Attribute) SetKey(v string) {
if x != nil {
x.Key = v
}
}
// SetValue sets value of the node attribute.
func (x *NodeInfo_Attribute) SetValue(v string) {
if x != nil {
x.Value = v
}
}
// SetParents sets parent keys.
func (x *NodeInfo_Attribute) SetParents(v []string) {
if x != nil {
x.Parents = v
}
}
// SetPublicKey sets public key of the FrostFS node in a binary format.
func (x *NodeInfo) SetPublicKey(v []byte) {
if x != nil {
x.PublicKey = v
}
}
// SetAddresses sets ways to connect to a node.
func (x *NodeInfo) SetAddresses(v []string) {
if x != nil {
x.Addresses = v
}
}
// SetAttributes sets attributes of the FrostFS Storage Node.
func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) {
if x != nil {
x.Attributes = v
}
}
// SetState sets state of the FrostFS node.
func (x *NodeInfo) SetState(v NetmapStatus) {
if x != nil {
x.State = v
}
}
// SetEpoch sets revision number of the network map.
func (x *Netmap) SetEpoch(v uint64) {
if x != nil {
x.Epoch = v
}
}
// SetNodes sets nodes presented in network.
func (x *Netmap) SetNodes(v []*NodeInfo) {
if x != nil {
x.Nodes = v
}
}
func (x *Netmap) MarshalJSON() ([]byte, error) {
return protojson.MarshalOptions{
EmitUnpopulated: true,
}.Marshal(x)
}
// SetID sets identificator of the shard.
func (x *ShardInfo) SetID(v []byte) {
x.Shard_ID = v
}
// SetMetabasePath sets path to shard's metabase.
func (x *ShardInfo) SetMetabasePath(v string) {
x.MetabasePath = v
}
// SetWriteCachePath sets path to shard's write-cache.
func (x *ShardInfo) SetWriteCachePath(v string) {
x.WritecachePath = v
}
// SetPiloramaPath sets path to shard's pilorama.
func (x *ShardInfo) SetPiloramaPath(v string) {
x.PiloramaPath = v
}
// SetMode sets path to shard's work mode.
func (x *ShardInfo) SetMode(v ShardMode) {
x.Mode = v
}
// SetErrorCount sets shard's error counter.
func (x *ShardInfo) SetErrorCount(count uint32) {
x.ErrorCount = count
}