-
Notifications
You must be signed in to change notification settings - Fork 199
/
coordinatorStub.go
40 lines (33 loc) · 1.21 KB
/
coordinatorStub.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
package mock
// CoordinatorStub -
type CoordinatorStub struct {
NumberOfShardsCalled func() uint32
ComputeIdCalled func(address []byte) uint32
SelfIdCalled func() uint32
SameShardCalled func(firstAddress, secondAddress []byte) bool
CommunicationIdentifierCalled func(destShardID uint32) string
}
// NumberOfShards -
func (coordinator *CoordinatorStub) NumberOfShards() uint32 {
return coordinator.NumberOfShardsCalled()
}
// ComputeId -
func (coordinator *CoordinatorStub) ComputeId(address []byte) uint32 {
return coordinator.ComputeIdCalled(address)
}
// SelfId -
func (coordinator *CoordinatorStub) SelfId() uint32 {
return coordinator.SelfIdCalled()
}
// SameShard -
func (coordinator *CoordinatorStub) SameShard(firstAddress, secondAddress []byte) bool {
return coordinator.SameShardCalled(firstAddress, secondAddress)
}
// CommunicationIdentifier -
func (coordinator *CoordinatorStub) CommunicationIdentifier(destShardID uint32) string {
return coordinator.CommunicationIdentifierCalled(destShardID)
}
// IsInterfaceNil returns true if there is no value under the interface
func (coordinator *CoordinatorStub) IsInterfaceNil() bool {
return coordinator == nil
}