-
Notifications
You must be signed in to change notification settings - Fork 199
/
latestStorageDataProviderStub.go
51 lines (41 loc) · 1.39 KB
/
latestStorageDataProviderStub.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
package mock
import "github.com/ElrondNetwork/elrond-go/storage"
// LatestStorageDataProviderStub -
type LatestStorageDataProviderStub struct {
GetParentDirAndLastEpochCalled func() (string, uint32, error)
GetCalled func() (storage.LatestDataFromStorage, error)
GetShardsFromDirectoryCalled func(path string) ([]string, error)
GetParentDirectoryCalled func() string
}
// GetParentDirectory -
func (lsdps *LatestStorageDataProviderStub) GetParentDirectory() string {
if lsdps.GetParentDirectoryCalled != nil {
return lsdps.GetParentDirectoryCalled()
}
return ""
}
// GetParentDirAndLastEpoch -
func (lsdps *LatestStorageDataProviderStub) GetParentDirAndLastEpoch() (string, uint32, error) {
if lsdps.GetParentDirAndLastEpochCalled != nil {
return lsdps.GetParentDirAndLastEpochCalled()
}
return "", 0, nil
}
// Get -
func (lsdps *LatestStorageDataProviderStub) Get() (storage.LatestDataFromStorage, error) {
if lsdps.GetCalled != nil {
return lsdps.GetCalled()
}
return storage.LatestDataFromStorage{}, nil
}
// GetShardsFromDirectory -
func (lsdps *LatestStorageDataProviderStub) GetShardsFromDirectory(path string) ([]string, error) {
if lsdps.GetShardsFromDirectoryCalled != nil {
return lsdps.GetShardsFromDirectoryCalled(path)
}
return nil, nil
}
// IsInterfaceNil -
func (lsdps *LatestStorageDataProviderStub) IsInterfaceNil() bool {
return lsdps == nil
}