tuweni / org.apache.tuweni.eth.repository / BlockchainIndex

BlockchainIndex

class BlockchainIndex : BlockchainIndexWriter, BlockchainIndexReader (source)

A Lucene-backed indexer capable of indexing blocks and block headers.

Constructors

<init>

BlockchainIndex(indexWriter: IndexWriter)

A Lucene-backed indexer capable of indexing blocks and block headers.

Functions

findBy

fun findBy(field: BlockHeaderFields, value: Bytes): List<Hash>
fun findBy(field: BlockHeaderFields, value: Long): List<Hash>
fun findBy(field: BlockHeaderFields, value: Gas): List<Hash>
fun findBy(field: BlockHeaderFields, value: UInt256): List<Hash>
fun findBy(field: BlockHeaderFields, value: Address): List<Hash>
fun findBy(field: BlockHeaderFields, value: Hash): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Bytes): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Int): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Long): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Gas): List<Hash>
fun findBy(field: TransactionReceiptFields, value: UInt256): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Address): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Hash): List<Hash>

Find exact matches for a field.

findByBlockHashAndIndex

fun findByBlockHashAndIndex(blockHash: Hash, index: Int): Hash?

Find a transaction request by block hash and index.

findByHashOrNumber

fun findByHashOrNumber(hashOrNumber: Bytes32): List<Hash>

Finds hashes of blocks by hash or number.

findByLargest

fun findByLargest(field: BlockHeaderFields): Hash?
fun findByLargest(field: TransactionReceiptFields): Hash?

Find the hash of the block header with the largest value of a specific block header field

findInRange

fun findInRange(field: BlockHeaderFields, minValue: UInt256, maxValue: UInt256): List<Hash>
fun findInRange(field: TransactionReceiptFields, minValue: UInt256, maxValue: UInt256): List<Hash>

Find a value in a range.

index

fun index(indexer: (BlockchainIndexWriter) -> Unit): Unit

Provides a function to index elements and committing them. If an exception is thrown in the function, the write is rolled back.

indexBlockHeader

fun indexBlockHeader(blockHeader: BlockHeader): Unit

Indexes a block header.

indexTransactionReceipt

fun indexTransactionReceipt(txReceipt: TransactionReceipt, txIndex: Int, txHash: Hash, blockHash: Hash): Unit

Indexes a transaction receipt.

totalDifficulty

fun totalDifficulty(hash: Hash): UInt256?

Retrieves the total difficulty of the block header, if it has been computed.