Class TransactionExpirationTable


  • public class TransactionExpirationTable
    extends Object
    Author:
    iris.dimni
    • Constructor Detail

      • TransactionExpirationTable

        public TransactionExpirationTable()
    • Method Detail

      • createTransactionExpirationTableIfNoneExists

        protected static void createTransactionExpirationTableIfNoneExists​(Connection conn)
      • createTransactionExpirationIndex

        protected static void createTransactionExpirationIndex​(Connection conn)
      • createTransactionExpirationIndex

        protected static void createTransactionExpirationIndex​(Connection conn,
                                                               String table)
        Parameters:
        conn -
        table -
      • createTransactionExpirationTableIfNoneExists

        protected static void createTransactionExpirationTableIfNoneExists​(Connection conn,
                                                                           String tableName)
        Parameters:
        conn -
        tableName -
      • insertExpirationInterferenceCandidateEntryDefaultHS

        protected static void insertExpirationInterferenceCandidateEntryDefaultHS​(Connection conn,
                                                                                  TransactionBox transactionBox)
        Parameters:
        conn -
        transactionBox -
      • insertExpirationInterferenceCandidateEntryHS

        protected static void insertExpirationInterferenceCandidateEntryHS​(Connection conn,
                                                                           String table,
                                                                           TransactionBox transactionBox)
        Parameters:
        conn -
        table -
        transactionBox -
      • countExpirationInterferenceCandidateDefaultTableHS

        protected static int countExpirationInterferenceCandidateDefaultTableHS​(Connection conn,
                                                                                String fromHS,
                                                                                String toHS,
                                                                                int interferenceList)
                                                                         throws SQLException
        Throws:
        SQLException
      • countExpirationInterferenceCandidateHS

        protected static int countExpirationInterferenceCandidateHS​(Connection conn,
                                                                    String table,
                                                                    String fromHS,
                                                                    String toHS,
                                                                    int interferenceList)
      • countExpirationInterferenceHS

        protected static int countExpirationInterferenceHS​(Connection conn,
                                                           String table,
                                                           String fromHS,
                                                           String toHS,
                                                           int interferenceList,
                                                           String candidateState)
        Select count(list) from CANDIDATE_LIST as CL where (CL.CANDIDATE = ‘CANDIDATE’) AND ((CL.FROM = and CL.list = ) or (CL.FROM = and CL.list = ) or (CL.TO = and CL.list = ) or (CL.TO = and CL.list = )) se count = 0 inserisco l’oggetto in lista
        Parameters:
        conn -
        table -
        fromHS -
        toHS -
        interferenceList -
        candidateState -
        Returns:
      • countExpirationEntryBySignatureHashHS

        protected static int countExpirationEntryBySignatureHashHS​(Connection conn,
                                                                   String table,
                                                                   String sith)
        Parameters:
        conn -
        table -
        sith -
        Returns:
      • getExpirationOrderedTransactionsCandidateByInterference

        protected static String getExpirationOrderedTransactionsCandidateByInterference​(Connection conn,
                                                                                        String table,
                                                                                        KeyContexts.TransactionType transactionType)
        get the hash of the first candidate fo block
        Parameters:
        conn -
        table -
        transactionType - transaction type
        Returns:
      • getExpirationListInterferenceIndexByHashHS

        protected static Integer getExpirationListInterferenceIndexByHashHS​(Connection conn,
                                                                            String table,
                                                                            String sigHash,
                                                                            KeyContexts.TransactionType transactionType)
        get the candidate list index or null
        Parameters:
        conn -
        table -
        sigHash -
        transactionType - transaction type
        Returns:
      • setExpirationInterferenceListAddedHS

        protected static long setExpirationInterferenceListAddedHS​(Connection conn,
                                                                   String table,
                                                                   String sigHash)
        Parameters:
        conn -
        table -
        sigHash -
        Returns:
      • setExpirationInterferenceListCorruptedHS

        protected static long setExpirationInterferenceListCorruptedHS​(Connection conn,
                                                                       String table,
                                                                       String sigHash)
        Parameters:
        conn -
        table -
        sigHash -
        Returns:
      • insertExpirationEntryHS

        protected static void insertExpirationEntryHS​(Connection conn,
                                                      String table,
                                                      String sith,
                                                      long unixTime)
        Parameters:
        conn -
        table -
        sith -
        unixTime -
        transactionBeanGson -
      • getExpirationTransactionBySignatureHS

        protected static ResultSet getExpirationTransactionBySignatureHS​(Connection conn,
                                                                         String table,
                                                                         String sith)
        Parameters:
        conn -
        table -
        sith -
        Returns:
        result set with all the transaction matching current signature hash
      • getExpirationTransactionBySignature

        protected static ResultSet getExpirationTransactionBySignature​(Connection conn,
                                                                       String sith)
        Parameters:
        conn -
        sith -
        Returns:
        result set with all the transaction matching current signature
      • getExpirationTransactionExpiredByDateHS

        protected static ResultSet getExpirationTransactionExpiredByDateHS​(Connection conn,
                                                                           String table,
                                                                           Date currentTime)
        return the hash of the expired transaction based on the date supplied
        Parameters:
        conn -
        table -
        currentTime -
        Returns:
      • getExpirationTransactionExpiredByDate

        protected static ResultSet getExpirationTransactionExpiredByDate​(Connection conn,
                                                                         Date currentTime)
        return the hash of the expired transaction based on the date supplied
        Parameters:
        conn -
        currentTime -
        Returns:
      • cleanExpiredTransactionsHS

        protected static long cleanExpiredTransactionsHS​(Connection conn,
                                                         String table,
                                                         Date currentTime)
        delete all expired transactions
        Parameters:
        conn -
        table -
        currentTime -
        Returns:
      • cleanExpiredTransactions

        protected static long cleanExpiredTransactions​(Connection conn,
                                                       Date currentTime)
        Parameters:
        conn -
        currentTime -
        Returns:
      • deleteTransactionsByState

        protected static long deleteTransactionsByState​(Connection conn,
                                                        KeyContexts.ExpirationTransactionState value)
        delete records from Transaction Expiration table by state(ADDED/CANDIDATE/CORRUPTED)
        Parameters:
        conn -
        value -
        Returns: