Package com.bank.trading.data
Class BackupData
java.lang.Object
com.bank.trading.data.BackupData
- All Implemented Interfaces:
Runnable
Backup data service that receives log data form the Lamport clock service
and then backs it up in SQL database.
Also retrieves the backup data from the long term storage.
-
Constructor Summary
ConstructorsConstructorDescriptionBackupData(URI storage, InetSocketAddress address, InetSocketAddress LamportAddress) Constructor to initialize the backup data service. -
Method Summary
Modifier and TypeMethodDescriptionvoidbackupData(byte[] logs) Backup log data to long term database storage.byte[]getBackupData(Long startTime, Long endTime) Retrieve backup data from long term storage.voidrun()Run the backup data service keep connection open to receive data and send to long term storage Message includes method calling and parameters Also accept incoming requests to retrieve backup data.voidsetStorageAddress(URI storageAddress) Set the address of the SQL Database.
-
Constructor Details
-
BackupData
Constructor to initialize the backup data service.- Parameters:
storage- the URI of the long term storage database.address- the address of the backup data service.LamportAddress- the address of the Lamport clock service.
-
-
Method Details
-
setStorageAddress
Set the address of the SQL Database.- Parameters:
storageAddress- the URI of the long term storage database.
-
backupData
public void backupData(byte[] logs) Backup log data to long term database storage. Convert from event logs to SQL format Send the data to the database at storageAddress.- Parameters:
logs- the byte array of the event logs to back up.
-
getBackupData
Retrieve backup data from long term storage.- Parameters:
startTime- the start time of the data to retrieve.endTime- the end time of the data to retrieve.- Returns:
- byte array of the backup data in event log format.
-
run
public void run()Run the backup data service keep connection open to receive data and send to long term storage Message includes method calling and parameters Also accept incoming requests to retrieve backup data.
-