public class HistoryFileManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HistoryFileManager.History
Class to store history deals and orders
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
updateJobIntervalInMilliseconds
Defines interval between update jobs.
|
| Constructor and Description |
|---|
HistoryFileManager(String accountId,
String application,
HistoryStorage historyStorage)
Constructs the history file manager instance
|
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
deleteStorageFromDisk()
Deletes storage files from disk
|
CompletableFuture<HistoryFileManager.History> |
getHistoryFromDisk()
Retrieves history from saved file
|
int |
getItemSize(Object item)
Helper function to calculate object size in bytes in utf-8 encoding
|
void |
setStartNewDealIndex(int index)
Sets the index of the earliest changed deal record
|
void |
setStartNewOrderIndex(int index)
Sets the index of the earliest changed historyOrder record
|
void |
startUpdateJob()
Starts a job to periodically save history on disk
|
void |
stopUpdateJob()
Stops a job to periodically save history on disk
|
CompletableFuture<Void> |
updateDiskStorage()
Saves unsaved history items to disk storage
|
protected int updateJobIntervalInMilliseconds
public HistoryFileManager(String accountId, String application, HistoryStorage historyStorage)
accountId - accound idapplication - MetaApi application idhistoryStorage - history storagepublic void startUpdateJob()
public void stopUpdateJob()
public int getItemSize(Object item) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic void setStartNewOrderIndex(int index)
index - of the earliest changed recordpublic void setStartNewDealIndex(int index)
index - of the earliest changed recordpublic CompletableFuture<HistoryFileManager.History> getHistoryFromDisk()
public CompletableFuture<Void> updateDiskStorage()
public CompletableFuture<Void> deleteStorageFromDisk()
Copyright © 2020. All rights reserved.