Browse Source

tx_indexer -> tx_index

pull/412/head
Ethan Buchman 8 years ago
parent
commit
9d2de2b756
7 changed files with 12 additions and 12 deletions
  1. +1
    -1
      config/tendermint/config.go
  2. +1
    -1
      config/tendermint_test/config.go
  3. +3
    -3
      node/node.go
  4. +1
    -1
      rpc/core/types/responses.go
  5. +3
    -3
      rpc/core/types/responses_test.go
  6. +2
    -2
      state/txindex/kv/kv_test.go
  7. +1
    -1
      state/txindex/null/null.go

+ 1
- 1
config/tendermint/config.go View File

@ -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
} }


+ 1
- 1
config/tendermint_test/config.go View File

@ -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"))


+ 3
- 3
node/node.go View File

@ -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),
}, },
} }


+ 1
- 1
rpc/core/types/responses.go View File

@ -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"
} }
} }


+ 3
- 3
rpc/core/types/responses_test.go View File

@ -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"}},
{true, []string{"tx_indexer=on", "tx_indexer=other"}},
{true, []string{"^(*^(", "tx_indexer=on", "a=n=b=d="}},
{false, []string{"tx_indexiskv", "some=dood"}},
{true, []string{"tx_index=on", "tx_index=other"}},
{true, []string{"^(*^(", "tx_index=on", "a=n=b=d="}},
} }
for _, tc := range cases { for _, tc := range cases {


+ 2
- 2
state/txindex/kv/kv_test.go View File

@ -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)


+ 1
- 1
state/txindex/null/null.go View File

@ -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.


Loading…
Cancel
Save