mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Use PersistenceManager for MapStoreService (not yet supported for subclasses)
This commit is contained in:
parent
2e55251bcf
commit
92b0ea9f13
1 changed files with 7 additions and 7 deletions
|
@ -19,9 +19,9 @@ package bisq.network.p2p.storage.persistence;
|
||||||
|
|
||||||
import bisq.network.p2p.storage.P2PDataStorage;
|
import bisq.network.p2p.storage.P2PDataStorage;
|
||||||
|
|
||||||
|
import bisq.common.persistence.PersistenceManager;
|
||||||
import bisq.common.proto.persistable.PersistableEnvelope;
|
import bisq.common.proto.persistable.PersistableEnvelope;
|
||||||
import bisq.common.proto.persistable.PersistablePayload;
|
import bisq.common.proto.persistable.PersistablePayload;
|
||||||
import bisq.common.storage.Storage;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ public abstract class MapStoreService<T extends PersistableEnvelope, R extends P
|
||||||
// Constructor
|
// Constructor
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public MapStoreService(File storageDir, Storage<T> storage) {
|
public MapStoreService(File storageDir, PersistenceManager<T> persistenceManager) {
|
||||||
super(storageDir, storage);
|
super(storageDir, persistenceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,18 +58,18 @@ public abstract class MapStoreService<T extends PersistableEnvelope, R extends P
|
||||||
|
|
||||||
void put(P2PDataStorage.ByteArray hash, R payload) {
|
void put(P2PDataStorage.ByteArray hash, R payload) {
|
||||||
getMap().put(hash, payload);
|
getMap().put(hash, payload);
|
||||||
persist();
|
requestPersistence();
|
||||||
}
|
}
|
||||||
|
|
||||||
R putIfAbsent(P2PDataStorage.ByteArray hash, R payload) {
|
R putIfAbsent(P2PDataStorage.ByteArray hash, R payload) {
|
||||||
R previous = getMap().putIfAbsent(hash, payload);
|
R previous = getMap().putIfAbsent(hash, payload);
|
||||||
persist();
|
requestPersistence();
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
R remove(P2PDataStorage.ByteArray hash) {
|
R remove(P2PDataStorage.ByteArray hash) {
|
||||||
final R result = getMap().remove(hash);
|
R result = getMap().remove(hash);
|
||||||
persist();
|
requestPersistence();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue