Class TransactionExpirationTable
- java.lang.Object
-
- com.h2tcoin.takamakachain.db.embedded.TransactionExpirationTable
-
public class TransactionExpirationTable extends Object
- Author:
- iris.dimni
-
-
Constructor Summary
Constructors Constructor Description TransactionExpirationTable()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static long
cleanExpiredTransactions(Connection conn, Date currentTime)
protected static long
cleanExpiredTransactionsHS(Connection conn, String table, Date currentTime)
delete all expired transactionsprotected static int
countExpirationEntryBySignatureHashHS(Connection conn, String sigHS)
protected static int
countExpirationEntryBySignatureHashHS(Connection conn, String table, String sith)
protected static int
countExpirationInterferenceCandidateDefaultTableHS(Connection conn, String fromHS, String toHS, int interferenceList)
protected static int
countExpirationInterferenceCandidateHS(Connection conn, String table, String fromHS, String toHS, int interferenceList)
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 protected static void
createTransactionExpirationIndex(Connection conn)
protected static void
createTransactionExpirationIndex(Connection conn, String table)
protected static void
createTransactionExpirationTableIfNoneExists(Connection conn)
protected static void
createTransactionExpirationTableIfNoneExists(Connection conn, String tableName)
protected static long
deleteTransactionsByState(Connection conn, KeyContexts.ExpirationTransactionState value)
delete records from Transaction Expiration table by state(ADDED/CANDIDATE/CORRUPTED)protected static List<AbstractMap.SimpleEntry<String,TransactionBox>>
getExpirationInterferenceListCandidateMembers(Connection conn, String table, int listIndex, KeyContexts.TransactionType transactionType)
return the transaction bean Candidate in the list or empty listprotected static Integer
getExpirationListInterferenceIndexByHashHS(Connection conn, String table, String sigHash, KeyContexts.TransactionType transactionType)
get the candidate list index or nullprotected static String
getExpirationOrderedTransactionsCandidateByInterference(Connection conn, String table, KeyContexts.TransactionType transactionType)
get the hash of the first candidate fo blockprotected static ResultSet
getExpirationTransactionBySignature(Connection conn, String sith)
protected static ResultSet
getExpirationTransactionBySignatureHS(Connection conn, String table, String sith)
protected static ResultSet
getExpirationTransactionExpiredByDate(Connection conn, Date currentTime)
return the hash of the expired transaction based on the date suppliedprotected static ResultSet
getExpirationTransactionExpiredByDateHS(Connection conn, String table, Date currentTime)
return the hash of the expired transaction based on the date suppliedprotected static void
insertExpirationEntryHS(Connection conn, String table, String sith, long unixTime)
protected static void
insertExpirationInterferenceCandidateEntryDefaultHS(Connection conn, TransactionBox transactionBox)
protected static void
insertExpirationInterferenceCandidateEntryHS(Connection conn, String table, TransactionBox transactionBox)
protected static void
insertExpirationInterferenceEntryHS(Connection conn, String table, TransactionBox transactionBox, KeyContexts.ExpirationTransactionState candidateState, int epoch, int slot)
protected static long
setExpirationInterferenceListAddedHS(Connection conn, String table, String sigHash)
protected static long
setExpirationInterferenceListCorruptedHS(Connection conn, String table, String sigHash)
-
-
-
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
-
-
insertExpirationInterferenceEntryHS
protected static void insertExpirationInterferenceEntryHS(Connection conn, String table, TransactionBox transactionBox, KeyContexts.ExpirationTransactionState candidateState, int epoch, int slot)
- Parameters:
conn
-table
-transactionBox
-candidateState
-epoch
-
-
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 sigHS) throws SQLException, NoSuchAlgorithmException
- Throws:
SQLException
NoSuchAlgorithmException
-
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:
-
getExpirationInterferenceListCandidateMembers
protected static List<AbstractMap.SimpleEntry<String,TransactionBox>> getExpirationInterferenceListCandidateMembers(Connection conn, String table, int listIndex, KeyContexts.TransactionType transactionType)
return the transaction bean Candidate in the list or empty list- Parameters:
conn
-table
-listIndex
-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:
-
-