class TransactionChecksumLookup {

    public long lookup( long txId ) throws IOException
    {
        // First off see if the requested txId is in fact the last committed transaction.
        // If so then we can extract the checksum directly from the transaction id store.
        TransactionId lastCommittedTransaction = transactionIdStore.getLastCommittedTransaction();
        if ( lastCommittedTransaction.transactionId() == txId )
        {
            return lastCommittedTransaction.checksum();
        }

        // Check if the requested txId is upgrade transaction
        // if so then use checksum form transaction id store.
        // That checksum can take specific values that should not be re-evaluated.
        if ( upgradeTransaction.transactionId() == txId )
        {
            return upgradeTransaction.checksum();
        }

        // It wasn't, so go look for it in the transaction store.
        // Intentionally let potentially thrown IOException (and NoSuchTransactionException) be thrown
        // from this call below, it's part of the contract of this method.
        try
        {
            return logicalTransactionStore.getMetadataFor( txId ).getChecksum();
        }
        catch ( NoSuchTransactionException e )
        {
            // So we truly couldn't find the checksum for this txId, go ahead and throw
            throw withMessage( e, e.getMessage() + " | transaction id store says last transaction is " +
                    lastCommittedTransaction + " and last upgrade transaction is " +
                    upgradeTransaction );
        }
    }

    public  TransactionChecksumLookup( TransactionIdStore transactionIdStore,
            LogicalTransactionStore logicalTransactionStore );

}