forked from CovenantSQL/CovenantSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdatebilling_gen.go
More file actions
168 lines (151 loc) · 4.12 KB
/
Copy pathupdatebilling_gen.go
File metadata and controls
168 lines (151 loc) · 4.12 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package types
// Code generated by github.com/CovenantSQL/HashStablePack DO NOT EDIT.
import (
herr "errors"
hsp "github.com/CovenantSQL/HashStablePack/marshalhash"
)
// MarshalHash marshals for hash
func (z *MinerIncome) MarshalHash() (o []byte, err error) {
var b []byte
o = hsp.Require(b, z.Msgsize())
// map header, size 2
o = append(o, 0x82)
o = hsp.AppendUint64(o, z.Income)
if oTemp, err := z.Miner.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *MinerIncome) Msgsize() (s int) {
s = 1 + 7 + hsp.Uint64Size + 6 + z.Miner.Msgsize()
return
}
// MarshalHash marshals for hash
func (z Range) MarshalHash() (o []byte, err error) {
var b []byte
o = hsp.Require(b, z.Msgsize())
// map header, size 2
o = append(o, 0x82)
o = hsp.AppendUint32(o, z.From)
o = hsp.AppendUint32(o, z.To)
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z Range) Msgsize() (s int) {
s = 1 + 5 + hsp.Uint32Size + 3 + hsp.Uint32Size
return
}
// MarshalHash marshals for hash
func (z *UpdateBilling) MarshalHash() (o []byte, err error) {
var b []byte
o = hsp.Require(b, z.Msgsize())
// map header, size 3
o = append(o, 0x83)
if oTemp, err := z.DefaultHashSignVerifierImpl.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
if oTemp, err := z.TransactionTypeMixin.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
if oTemp, err := z.UpdateBillingHeader.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *UpdateBilling) Msgsize() (s int) {
s = 1 + 28 + z.DefaultHashSignVerifierImpl.Msgsize() + 21 + z.TransactionTypeMixin.Msgsize() + 20 + z.UpdateBillingHeader.Msgsize()
return
}
var hspVersionsUpdateBillingHeader = []string{
"oldver",
"9ef447",
}
// HSPCurrentVersion returns current struct version
func (z *UpdateBillingHeader) HSPCurrentVersion() int {
return int(z.Version)
}
// HSPMaxVersion returns max struct version
func (z *UpdateBillingHeader) HSPMaxVersion() int {
return 1
}
// HSPDefaultVersion returns default struct version
func (z *UpdateBillingHeader) HSPDefaultVersion() int {
return 1
}
// MarshalHash marshals for hash
func (z *UpdateBillingHeader) MarshalHash() (o []byte, err error) {
switch z.HSPCurrentVersion() {
case 0:
return z.MarshalHasholdver()
case 1:
return z.MarshalHash9ef447()
default:
err = herr.New("invalid struct version")
return
}
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *UpdateBillingHeader) Msgsize() (s int) {
switch z.HSPCurrentVersion() {
case 0:
return z.Msgsizeoldver()
case 1:
return z.Msgsize9ef447()
default:
return 0
}
return
}
// MarshalHash marshals for hash
func (z *UserCost) MarshalHash() (o []byte, err error) {
var b []byte
o = hsp.Require(b, z.Msgsize())
// map header, size 3
o = append(o, 0x83)
o = hsp.AppendUint64(o, z.Cost)
o = hsp.AppendArrayHeader(o, uint32(len(z.Miners)))
for za0001 := range z.Miners {
if z.Miners[za0001] == nil {
o = hsp.AppendNil(o)
} else {
// map header, size 2
o = append(o, 0x82)
if oTemp, err := z.Miners[za0001].Miner.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
o = hsp.AppendUint64(o, z.Miners[za0001].Income)
}
}
if oTemp, err := z.User.MarshalHash(); err != nil {
return nil, err
} else {
o = hsp.AppendBytes(o, oTemp)
}
return
}
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *UserCost) Msgsize() (s int) {
s = 1 + 5 + hsp.Uint64Size + 7 + hsp.ArrayHeaderSize
for za0001 := range z.Miners {
if z.Miners[za0001] == nil {
s += hsp.NilSize
} else {
s += 1 + 6 + z.Miners[za0001].Miner.Msgsize() + 7 + hsp.Uint64Size
}
}
s += 5 + z.User.Msgsize()
return
}