-
Notifications
You must be signed in to change notification settings - Fork 170
/
protocol_state_machine.go
169 lines (137 loc) · 3.89 KB
/
protocol_state_machine.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
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
169
// Code generated by mockery v2.21.4. DO NOT EDIT.
package mock
import (
flow "github.com/onflow/flow-go/model/flow"
mock "github.com/stretchr/testify/mock"
)
// ProtocolStateMachine is an autogenerated mock type for the ProtocolStateMachine type
type ProtocolStateMachine struct {
mock.Mock
}
// Build provides a mock function with given fields:
func (_m *ProtocolStateMachine) Build() (*flow.ProtocolStateEntry, flow.Identifier, bool) {
ret := _m.Called()
var r0 *flow.ProtocolStateEntry
var r1 flow.Identifier
var r2 bool
if rf, ok := ret.Get(0).(func() (*flow.ProtocolStateEntry, flow.Identifier, bool)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *flow.ProtocolStateEntry); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*flow.ProtocolStateEntry)
}
}
if rf, ok := ret.Get(1).(func() flow.Identifier); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(flow.Identifier)
}
}
if rf, ok := ret.Get(2).(func() bool); ok {
r2 = rf()
} else {
r2 = ret.Get(2).(bool)
}
return r0, r1, r2
}
// EjectIdentity provides a mock function with given fields: nodeID
func (_m *ProtocolStateMachine) EjectIdentity(nodeID flow.Identifier) error {
ret := _m.Called(nodeID)
var r0 error
if rf, ok := ret.Get(0).(func(flow.Identifier) error); ok {
r0 = rf(nodeID)
} else {
r0 = ret.Error(0)
}
return r0
}
// ParentState provides a mock function with given fields:
func (_m *ProtocolStateMachine) ParentState() *flow.RichProtocolStateEntry {
ret := _m.Called()
var r0 *flow.RichProtocolStateEntry
if rf, ok := ret.Get(0).(func() *flow.RichProtocolStateEntry); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*flow.RichProtocolStateEntry)
}
}
return r0
}
// ProcessEpochCommit provides a mock function with given fields: epochCommit
func (_m *ProtocolStateMachine) ProcessEpochCommit(epochCommit *flow.EpochCommit) (bool, error) {
ret := _m.Called(epochCommit)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(*flow.EpochCommit) (bool, error)); ok {
return rf(epochCommit)
}
if rf, ok := ret.Get(0).(func(*flow.EpochCommit) bool); ok {
r0 = rf(epochCommit)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(*flow.EpochCommit) error); ok {
r1 = rf(epochCommit)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ProcessEpochSetup provides a mock function with given fields: epochSetup
func (_m *ProtocolStateMachine) ProcessEpochSetup(epochSetup *flow.EpochSetup) (bool, error) {
ret := _m.Called(epochSetup)
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(*flow.EpochSetup) (bool, error)); ok {
return rf(epochSetup)
}
if rf, ok := ret.Get(0).(func(*flow.EpochSetup) bool); ok {
r0 = rf(epochSetup)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(*flow.EpochSetup) error); ok {
r1 = rf(epochSetup)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TransitionToNextEpoch provides a mock function with given fields:
func (_m *ProtocolStateMachine) TransitionToNextEpoch() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// View provides a mock function with given fields:
func (_m *ProtocolStateMachine) View() uint64 {
ret := _m.Called()
var r0 uint64
if rf, ok := ret.Get(0).(func() uint64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(uint64)
}
return r0
}
type mockConstructorTestingTNewProtocolStateMachine interface {
mock.TestingT
Cleanup(func())
}
// NewProtocolStateMachine creates a new instance of ProtocolStateMachine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewProtocolStateMachine(t mockConstructorTestingTNewProtocolStateMachine) *ProtocolStateMachine {
mock := &ProtocolStateMachine{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}