mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-20 16:36:31 +00:00
tx_indexer -> tx_index
This commit is contained in:
@ -101,7 +101,7 @@ func GetConfig(rootDir string) cfg.Config {
|
|||||||
mapConfig.SetDefault("mempool_broadcast", true)
|
mapConfig.SetDefault("mempool_broadcast", true)
|
||||||
mapConfig.SetDefault("mempool_wal_dir", rootDir+"/data/mempool.wal")
|
mapConfig.SetDefault("mempool_wal_dir", rootDir+"/data/mempool.wal")
|
||||||
|
|
||||||
mapConfig.SetDefault("tx_indexer", "kv")
|
mapConfig.SetDefault("tx_index", "kv")
|
||||||
|
|
||||||
return mapConfig
|
return mapConfig
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ func ResetConfig(localPath string) cfg.Config {
|
|||||||
mapConfig.SetDefault("mempool_broadcast", true)
|
mapConfig.SetDefault("mempool_broadcast", true)
|
||||||
mapConfig.SetDefault("mempool_wal_dir", "")
|
mapConfig.SetDefault("mempool_wal_dir", "")
|
||||||
|
|
||||||
mapConfig.SetDefault("tx_indexer", "kv")
|
mapConfig.SetDefault("tx_index", "kv")
|
||||||
|
|
||||||
logger.SetLogLevel(mapConfig.GetString("log_level"))
|
logger.SetLogLevel(mapConfig.GetString("log_level"))
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@ func NewNode(config cfg.Config, privValidator *types.PrivValidator, clientCreato
|
|||||||
|
|
||||||
// Transaction indexing
|
// Transaction indexing
|
||||||
var txIndexer txindex.TxIndexer
|
var txIndexer txindex.TxIndexer
|
||||||
switch config.GetString("tx_indexer") {
|
switch config.GetString("tx_index") {
|
||||||
case "kv":
|
case "kv":
|
||||||
store := dbm.NewDB("tx_indexer", config.GetString("db_backend"), config.GetString("db_dir"))
|
store := dbm.NewDB("tx_index", config.GetString("db_backend"), config.GetString("db_dir"))
|
||||||
txIndexer = kv.NewTxIndex(store)
|
txIndexer = kv.NewTxIndex(store)
|
||||||
default:
|
default:
|
||||||
txIndexer = &null.TxIndex{}
|
txIndexer = &null.TxIndex{}
|
||||||
@ -381,7 +381,7 @@ func (n *Node) makeNodeInfo() *p2p.NodeInfo {
|
|||||||
cmn.Fmt("p2p_version=%v", p2p.Version),
|
cmn.Fmt("p2p_version=%v", p2p.Version),
|
||||||
cmn.Fmt("consensus_version=%v", consensus.Version),
|
cmn.Fmt("consensus_version=%v", consensus.Version),
|
||||||
cmn.Fmt("rpc_version=%v/%v", rpc.Version, rpccore.Version),
|
cmn.Fmt("rpc_version=%v/%v", rpc.Version, rpccore.Version),
|
||||||
cmn.Fmt("tx_indexer=%v", txIndexerStatus),
|
cmn.Fmt("tx_index=%v", txIndexerStatus),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ func (s *ResultStatus) TxIndexEnabled() bool {
|
|||||||
}
|
}
|
||||||
for _, s := range s.NodeInfo.Other {
|
for _, s := range s.NodeInfo.Other {
|
||||||
info := strings.Split(s, "=")
|
info := strings.Split(s, "=")
|
||||||
if len(info) == 2 && info[0] == "tx_indexer" {
|
if len(info) == 2 && info[0] == "tx_index" {
|
||||||
return info[1] == "on"
|
return info[1] == "on"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,9 @@ func TestStatusIndexer(t *testing.T) {
|
|||||||
{false, nil},
|
{false, nil},
|
||||||
{false, []string{}},
|
{false, []string{}},
|
||||||
{false, []string{"a=b"}},
|
{false, []string{"a=b"}},
|
||||||
{false, []string{"tx_indexeriskv", "some=dood"}},
|
{false, []string{"tx_indexiskv", "some=dood"}},
|
||||||
{true, []string{"tx_indexer=on", "tx_indexer=other"}},
|
{true, []string{"tx_index=on", "tx_index=other"}},
|
||||||
{true, []string{"^(*^(", "tx_indexer=on", "a=n=b=d="}},
|
{true, []string{"^(*^(", "tx_index=on", "a=n=b=d="}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
@ -34,13 +34,13 @@ func benchmarkTxIndex(txsCount int, b *testing.B) {
|
|||||||
tx := types.Tx("HELLO WORLD")
|
tx := types.Tx("HELLO WORLD")
|
||||||
txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeType_OK, Log: ""}}
|
txResult := &types.TxResult{1, 0, tx, abci.ResponseDeliverTx{Data: []byte{0}, Code: abci.CodeType_OK, Log: ""}}
|
||||||
|
|
||||||
dir, err := ioutil.TempDir("", "tx_indexer_db")
|
dir, err := ioutil.TempDir("", "tx_index_db")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
store := db.NewDB("tx_indexer", "leveldb", dir)
|
store := db.NewDB("tx_index", "leveldb", dir)
|
||||||
indexer := &TxIndex{store: store}
|
indexer := &TxIndex{store: store}
|
||||||
|
|
||||||
batch := txindex.NewBatch(txsCount)
|
batch := txindex.NewBatch(txsCount)
|
||||||
|
@ -12,7 +12,7 @@ type TxIndex struct{}
|
|||||||
|
|
||||||
// Tx panics.
|
// Tx panics.
|
||||||
func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) {
|
func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) {
|
||||||
return nil, errors.New(`Indexing is disabled (set 'tx_indexer = "kv"' in config)`)
|
return nil, errors.New(`Indexing is disabled (set 'tx_index = "kv"' in config)`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Batch returns nil.
|
// Batch returns nil.
|
||||||
|
Reference in New Issue
Block a user