github.com/evdatsion/aphelion-dpos-bft@v0.32.1/state/txindex/null/null.go (about) 1 package null 2 3 import ( 4 "errors" 5 6 "github.com/evdatsion/aphelion-dpos-bft/libs/pubsub/query" 7 "github.com/evdatsion/aphelion-dpos-bft/state/txindex" 8 "github.com/evdatsion/aphelion-dpos-bft/types" 9 ) 10 11 var _ txindex.TxIndexer = (*TxIndex)(nil) 12 13 // TxIndex acts as a /dev/null. 14 type TxIndex struct{} 15 16 // Get on a TxIndex is disabled and panics when invoked. 17 func (txi *TxIndex) Get(hash []byte) (*types.TxResult, error) { 18 return nil, errors.New(`Indexing is disabled (set 'tx_index = "kv"' in config)`) 19 } 20 21 // AddBatch is a noop and always returns nil. 22 func (txi *TxIndex) AddBatch(batch *txindex.Batch) error { 23 return nil 24 } 25 26 // Index is a noop and always returns nil. 27 func (txi *TxIndex) Index(result *types.TxResult) error { 28 return nil 29 } 30 31 func (txi *TxIndex) Search(q *query.Query) ([]*types.TxResult, error) { 32 return []*types.TxResult{}, nil 33 }