github.com/aakash4dev/cometbft@v0.38.2/state/txindex/null/null.go (about)

     1  package null
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  
     7  	"github.com/aakash4dev/cometbft/libs/log"
     8  
     9  	abci "github.com/aakash4dev/cometbft/abci/types"
    10  	"github.com/aakash4dev/cometbft/libs/pubsub/query"
    11  	"github.com/aakash4dev/cometbft/state/txindex"
    12  )
    13  
    14  var _ txindex.TxIndexer = (*TxIndex)(nil)
    15  
    16  // TxIndex acts as a /dev/null.
    17  type TxIndex struct{}
    18  
    19  // Get on a TxIndex is disabled and panics when invoked.
    20  func (txi *TxIndex) Get(_ []byte) (*abci.TxResult, error) {
    21  	return nil, errors.New(`indexing is disabled (set 'tx_index = "kv"' in config)`)
    22  }
    23  
    24  // AddBatch is a noop and always returns nil.
    25  func (txi *TxIndex) AddBatch(_ *txindex.Batch) error {
    26  	return nil
    27  }
    28  
    29  // Index is a noop and always returns nil.
    30  func (txi *TxIndex) Index(_ *abci.TxResult) error {
    31  	return nil
    32  }
    33  
    34  func (txi *TxIndex) Search(_ context.Context, _ *query.Query) ([]*abci.TxResult, error) {
    35  	return []*abci.TxResult{}, nil
    36  }
    37  
    38  func (txi *TxIndex) SetLogger(log.Logger) {
    39  
    40  }