-
Notifications
You must be signed in to change notification settings - Fork 197
/
bootstrapDataProviderStub.go
36 lines (29 loc) · 1.08 KB
/
bootstrapDataProviderStub.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
package mock
import (
"github.com/ElrondNetwork/elrond-go/process"
"github.com/ElrondNetwork/elrond-go/process/block/bootstrapStorage"
"github.com/ElrondNetwork/elrond-go/storage"
)
// BootStrapDataProviderStub -
type BootStrapDataProviderStub struct {
LoadForPathCalled func(persisterFactory storage.PersisterFactory, path string) (*bootstrapStorage.BootstrapData, storage.Storer, error)
GetStorerCalled func(storer storage.Storer) (process.BootStorer, error)
}
// LoadForPath -
func (b *BootStrapDataProviderStub) LoadForPath(persisterFactory storage.PersisterFactory, path string) (*bootstrapStorage.BootstrapData, storage.Storer, error) {
if b.LoadForPathCalled != nil {
return b.LoadForPathCalled(persisterFactory, path)
}
return &bootstrapStorage.BootstrapData{}, nil, nil
}
// GetStorer -
func (b *BootStrapDataProviderStub) GetStorer(storer storage.Storer) (process.BootStorer, error) {
if b.GetStorerCalled != nil {
return b.GetStorerCalled(storer)
}
return nil, nil
}
// IsInterfaceNil -
func (b *BootStrapDataProviderStub) IsInterfaceNil() bool {
return b == nil
}