public class AccountFileStore extends AccountStoreImpl
| Constructor and Description |
|---|
AccountFileStore() |
AccountFileStore(File file) |
AccountFileStore(Store fileStore)
Takes any store, but make sure the store allows saving of POJOs, and not just key/value Strings
|
AccountFileStore(String file) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDepositAddress(String id,
int index,
StoredDepositAddress request)
Stores the deposit address under the given account with the used key index.
|
void |
addPendingTransfer(String id,
Hash tailTx,
Trytes[] bundleTrytes,
int... indices)
Stores the pending transfer under the given account with the origin tail tx hash as a key and
removes all deposit addresses which correspond to the used key indices for the transfer.
|
void |
addTailHash(String id,
Hash tailHash,
Hash newTailTxHash)
Adds the given new tail transaction hash (presumably from a reattachment) under the given pending transfer
indexed by the given origin tail transaction hash.
|
ExportedAccountState |
exportAccount(String id)
Axports the given account from the store.
|
Map<Integer,StoredDepositAddress> |
getDepositAddresses(String id)
Loads the stored deposit addresses of the given account.
|
Map<String,PendingTransfer> |
getPendingTransfers(String id)
Returns all pending transfers of the given account.
|
void |
importAccount(ExportedAccountState state)
Imports the given account state into the store.
|
void |
load()
Loads this task
|
AccountState |
loadAccount(String id)
Loads an existing or allocates a new account state from/in the database and returns the state.
|
int |
readIndex(String id)
Reads and returns the last used key index.
|
void |
removeAccount(String id)
Removes the accoutn state linekd to this account.
|
void |
removeDepositAddress(String id,
int index)
Removes the deposit address with the given key index under the given account.
|
void |
removePendingTransfer(String id,
Hash tailHash)
Removes the pending transfer with the given origin tail transaction hash from the given account.
|
void |
saveAccount(String id,
AccountState state)
Saves this specific account state to the store, regardless of what was stored.
|
void |
shutdown()
Stops this task.
|
boolean |
start()
Starts this task
|
String |
toString() |
void |
writeIndex(String id,
int index)
Stores the given index as the last used key index for the given account.
|
trytesToTritspublic AccountFileStore()
public AccountFileStore(File file)
public AccountFileStore(Store fileStore)
fileStore - Storage we use for reading/writing our account datapublic AccountFileStore(String file)
public void load()
throws Exception
TaskServiceException - when loading failedpublic boolean start()
TaskServicetrue if loaded successful. otherwise falsepublic void shutdown()
TaskServicepublic AccountState loadAccount(String id)
AccountStoreid - The account we are loading or creatingpublic void saveAccount(String id, AccountState state)
AccountStoreid - The id of the account we are storingstate - The state we are storing for the accountpublic void removeAccount(String id)
AccountStoreid - The id of the accountpublic int readIndex(String id)
AccountStoreid - The id of the account we check forpublic void writeIndex(String id, int index)
AccountStoreid - The id of the accountindex - The new index of this accountpublic void addDepositAddress(String id, int index, StoredDepositAddress request)
AccountStoreid - The id of the accountindex - The index used for this addressrequest - The deposit address we are addingpublic void removeDepositAddress(String id, int index)
AccountStoreid - The id of the accountindex - The index of the deposit we are removingpublic Map<Integer,StoredDepositAddress> getDepositAddresses(String id)
AccountStoreid - The id of the accountpublic void addPendingTransfer(String id, Hash tailTx, Trytes[] bundleTrytes, int... indices)
AccountStoreid - The id of the accounttailTx - The tail tx of this transferbundleTrytes - The trytes/essense of this transferindices - indexes to remove for this transfer, currently unused since we remove when we ask for inputspublic void removePendingTransfer(String id, Hash tailHash)
AccountStoreid - The id of the accounttailHash - The tail tx of the transfer we are remivingpublic void addTailHash(String id, Hash tailHash, Hash newTailTxHash)
AccountStoreid - The id of the accounttailHash - The tail tx of the initial transfernewTailTxHash - The tail tx of the newly added transferpublic Map<String,PendingTransfer> getPendingTransfers(String id)
AccountStoreid - The id of the accountpublic void importAccount(ExportedAccountState state)
AccountStorestate - The state of the account we are storingpublic ExportedAccountState exportAccount(String id)
AccountStoreid - The id of the account we want to exportCopyright © 2019. All rights reserved.