-
Notifications
You must be signed in to change notification settings - Fork 199
/
dataComponentsStub.go
90 lines (74 loc) · 1.88 KB
/
dataComponentsStub.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
package mock
import (
"sync"
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/factory"
)
// DataComponentsStub -
type DataComponentsStub struct {
BlockChain data.ChainHandler
Store dataRetriever.StorageService
DataPool dataRetriever.PoolsHolder
MbProvider factory.MiniBlockProvider
EconomicsData factory.EconomicsHandler
mutDcm sync.RWMutex
}
// Create -
func (dcs *DataComponentsStub) Create() error {
return nil
}
// Close -
func (dcs *DataComponentsStub) Close() error {
return nil
}
// CheckSubcomponents -
func (dcs *DataComponentsStub) CheckSubcomponents() error {
return nil
}
// Blockchain -
func (dcs *DataComponentsStub) Blockchain() data.ChainHandler {
dcs.mutDcm.RLock()
defer dcs.mutDcm.RUnlock()
return dcs.BlockChain
}
// SetBlockchain -
func (dcs *DataComponentsStub) SetBlockchain(chain data.ChainHandler) error {
dcs.mutDcm.Lock()
dcs.BlockChain = chain
dcs.mutDcm.Unlock()
return nil
}
// StorageService -
func (dcs *DataComponentsStub) StorageService() dataRetriever.StorageService {
return dcs.Store
}
// Datapool -
func (dcs *DataComponentsStub) Datapool() dataRetriever.PoolsHolder {
return dcs.DataPool
}
// MiniBlocksProvider -
func (dcs *DataComponentsStub) MiniBlocksProvider() factory.MiniBlockProvider {
return dcs.MbProvider
}
// EconomicsHandler -
func (dcs *DataComponentsStub) EconomicsHandler() factory.EconomicsHandler {
return dcs.EconomicsData
}
// Clone -
func (dcs *DataComponentsStub) Clone() interface{} {
return &DataComponentsStub{
BlockChain: dcs.BlockChain,
Store: dcs.Store,
DataPool: dcs.DataPool,
MbProvider: dcs.MbProvider,
}
}
// String -
func (dcs *DataComponentsStub) String() string {
return "DataComponentsStub"
}
// IsInterfaceNil -
func (dcs *DataComponentsStub) IsInterfaceNil() bool {
return dcs == nil
}