-
Notifications
You must be signed in to change notification settings - Fork 199
/
trieStorageManagerWithoutCheckpoints.go
42 lines (35 loc) · 1.25 KB
/
trieStorageManagerWithoutCheckpoints.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
package trie
import (
"github.com/ElrondNetwork/elrond-go-core/core"
"github.com/ElrondNetwork/elrond-go-core/core/check"
"github.com/ElrondNetwork/elrond-go/common"
)
// trieStorageManagerWithoutCheckpoints manages the storage operations of the trie, but does not create checkpoints
type trieStorageManagerWithoutCheckpoints struct {
common.StorageManager
}
// NewTrieStorageManagerWithoutCheckpoints creates a new instance of trieStorageManagerWithoutCheckpoints
func NewTrieStorageManagerWithoutCheckpoints(tsm common.StorageManager) (*trieStorageManagerWithoutCheckpoints, error) {
if check.IfNil(tsm) {
return nil, ErrNilTrieStorage
}
return &trieStorageManagerWithoutCheckpoints{
StorageManager: tsm,
}, nil
}
// SetCheckpoint does nothing if pruning is disabled
func (tsm *trieStorageManagerWithoutCheckpoints) SetCheckpoint(
_ []byte,
_ []byte,
chLeaves chan core.KeyValueHolder,
_ chan error,
stats common.SnapshotStatisticsHandler,
) {
safelyCloseChan(chLeaves)
stats.SnapshotFinished()
log.Debug("trieStorageManagerWithoutCheckpoints - SetCheckpoint is disabled")
}
// AddDirtyCheckpointHashes returns false
func (tsm *trieStorageManagerWithoutCheckpoints) AddDirtyCheckpointHashes(_ []byte, _ common.ModifiedHashes) bool {
return false
}