mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #4930 from chimp1984/use-historical-data-store-for-account-age
Use HistoricalDataStoreService for AccountAgeWitnessStorageService
This commit is contained in:
commit
810c0da0f9
@ -17,9 +17,8 @@
|
||||
|
||||
package bisq.core.account.witness;
|
||||
|
||||
import bisq.network.p2p.storage.P2PDataStorage;
|
||||
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;
|
||||
import bisq.network.p2p.storage.persistence.MapStoreService;
|
||||
import bisq.network.p2p.storage.persistence.HistoricalDataStoreService;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.persistence.PersistenceManager;
|
||||
@ -29,12 +28,10 @@ import javax.inject.Named;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class AccountAgeWitnessStorageService extends MapStoreService<AccountAgeWitnessStore, PersistableNetworkPayload> {
|
||||
public class AccountAgeWitnessStorageService extends HistoricalDataStoreService<AccountAgeWitnessStore> {
|
||||
private static final String FILE_NAME = "AccountAgeWitnessStore";
|
||||
|
||||
|
||||
@ -48,23 +45,19 @@ public class AccountAgeWitnessStorageService extends MapStoreService<AccountAgeW
|
||||
super(storageDir, persistenceManager);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected void initializePersistenceManager() {
|
||||
persistenceManager.initialize(store, PersistenceManager.Source.NETWORK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return FILE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
|
||||
return store.getMap();
|
||||
protected void initializePersistenceManager() {
|
||||
persistenceManager.initialize(store, PersistenceManager.Source.NETWORK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,6 +12,6 @@ resDir=p2p/src/main/resources
|
||||
# Only commit new TradeStatistics3Store if you plan to add it to
|
||||
# https://github.com/bisq-network/bisq/blob/0345c795e2c227d827a1f239a323dda1250f4e69/common/src/main/java/bisq/common/app/Version.java#L40 as well.
|
||||
cp "$dbDir/TradeStatistics3Store" "$resDir/TradeStatistics3Store_${version}_BTC_MAINNET"
|
||||
cp "$dbDir/AccountAgeWitnessStore" "$resDir/AccountAgeWitnessStore_BTC_MAINNET"
|
||||
cp "$dbDir/AccountAgeWitnessStore" "$resDir/AccountAgeWitnessStore_${version}_BTC_MAINNET"
|
||||
cp "$dbDir/DaoStateStore" "$resDir/DaoStateStore_BTC_MAINNET"
|
||||
cp "$dbDir/SignedWitnessStore" "$resDir/SignedWitnessStore_BTC_MAINNET"
|
||||
|
@ -192,10 +192,7 @@ public abstract class HistoricalDataStoreService<T extends PersistableNetworkPay
|
||||
pruneStore(persisted, version);
|
||||
completeHandler.run();
|
||||
},
|
||||
() -> {
|
||||
log.warn("Resource file with file name {} does not exits.", fileName);
|
||||
completeHandler.run();
|
||||
});
|
||||
completeHandler::run);
|
||||
}
|
||||
|
||||
private void pruneStore(PersistableNetworkPayloadStore<? extends PersistableNetworkPayload> historicalStore,
|
||||
|
Loading…
Reference in New Issue
Block a user