@@ -20,6 +20,7 @@ import (
20
20
21
21
"github.com/iotexproject/iotex-core/v2/action"
22
22
"github.com/iotexproject/iotex-core/v2/action/protocol"
23
+ "github.com/iotexproject/iotex-core/v2/action/protocol/execution/evm"
23
24
"github.com/iotexproject/iotex-core/v2/actpool"
24
25
"github.com/iotexproject/iotex-core/v2/blockchain/block"
25
26
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
@@ -31,6 +32,13 @@ import (
31
32
"github.com/iotexproject/iotex-core/v2/state"
32
33
)
33
34
35
+ var (
36
+ // VersionedMetadata is the metadata namespace for versioned stateDB
37
+ VersionedMetadata = "Meta"
38
+ // VersionedNamespaces are the versioned namespaces for versioned stateDB
39
+ VersionedNamespaces = []string {AccountKVNamespace , evm .ContractKVNameSpace }
40
+ )
41
+
34
42
type (
35
43
// daoRetrofitter represents the DAO-related methods to accommodate archive-mode
36
44
daoRetrofitter interface {
53
61
protocolView protocol.View
54
62
skipBlockValidationOnPut bool
55
63
ps * patchStore
56
- metaNS string // metadata namespace, only meaningful when archive-mode enabled
57
64
}
58
65
)
59
66
@@ -92,14 +99,6 @@ func DisableWorkingSetCacheOption() StateDBOption {
92
99
}
93
100
}
94
101
95
- // MetadataNamespaceOption specifies the metadat namespace for versioned DB
96
- func MetadataNamespaceOption (ns string ) StateDBOption {
97
- return func (sdb * stateDB , cfg * Config ) error {
98
- sdb .metaNS = ns
99
- return nil
100
- }
101
- }
102
-
103
102
// NewStateDB creates a new state db
104
103
func NewStateDB (cfg Config , dao db.KVStore , opts ... StateDBOption ) (Factory , error ) {
105
104
sdb := stateDB {
@@ -120,7 +119,7 @@ func NewStateDB(cfg Config, dao db.KVStore, opts ...StateDBOption) (Factory, err
120
119
if ! ok {
121
120
return nil , errors .Wrap (ErrNotSupported , "cannot enable archive mode StateDB with non-versioned DB" )
122
121
}
123
- sdb .dao = newDaoRetrofitterArchive (daoVersioned , sdb . metaNS )
122
+ sdb .dao = newDaoRetrofitterArchive (daoVersioned , VersionedMetadata )
124
123
} else {
125
124
sdb .dao = newDaoRetrofitter (dao )
126
125
}
0 commit comments