Refactor: Rename class

This commit is contained in:
chimp1984 2021-01-10 22:59:56 -05:00
parent 5ba7d78a39
commit 41a92eae7f
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 19 additions and 19 deletions

View File

@ -39,7 +39,7 @@ import bisq.network.p2p.mailbox.IgnoredMailboxService;
import bisq.network.p2p.mailbox.MailboxMessageService;
import bisq.network.p2p.peers.PeerManager;
import bisq.network.p2p.storage.P2PDataStorage;
import bisq.network.p2p.storage.persistence.RemovedPayloadsStorageService;
import bisq.network.p2p.storage.persistence.RemovedPayloadsService;
import bisq.common.config.Config;
import bisq.common.proto.persistable.PersistedDataHost;
@ -71,7 +71,7 @@ public class CorePersistedDataHost {
persistedDataHosts.add(injector.getInstance(PeerManager.class));
persistedDataHosts.add(injector.getInstance(MailboxMessageService.class));
persistedDataHosts.add(injector.getInstance(IgnoredMailboxService.class));
persistedDataHosts.add(injector.getInstance(RemovedPayloadsStorageService.class));
persistedDataHosts.add(injector.getInstance(RemovedPayloadsService.class));
if (injector.getInstance(Config.class).daoActivated) {
persistedDataHosts.add(injector.getInstance(BallotListService.class));

View File

@ -51,7 +51,7 @@ import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreService;
import bisq.network.p2p.storage.persistence.HistoricalDataStoreService;
import bisq.network.p2p.storage.persistence.PersistableNetworkPayloadStore;
import bisq.network.p2p.storage.persistence.ProtectedDataStoreService;
import bisq.network.p2p.storage.persistence.RemovedPayloadsStorageService;
import bisq.network.p2p.storage.persistence.RemovedPayloadsService;
import bisq.network.p2p.storage.persistence.ResourceDataStoreService;
import bisq.network.p2p.storage.persistence.SequenceNumberMap;
@ -143,7 +143,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
final SequenceNumberMap sequenceNumberMap = new SequenceNumberMap();
private final Set<AppendOnlyDataStoreListener> appendOnlyDataStoreListeners = new CopyOnWriteArraySet<>();
private final RemovedPayloadsStorageService removedPayloadsStorageService;
private final RemovedPayloadsService removedPayloadsService;
private final Clock clock;
/// The maximum number of items that must exist in the SequenceNumberMap before it is scheduled for a purge
@ -165,7 +165,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
ProtectedDataStoreService protectedDataStoreService,
ResourceDataStoreService resourceDataStoreService,
PersistenceManager<SequenceNumberMap> persistenceManager,
RemovedPayloadsStorageService removedPayloadsStorageService,
RemovedPayloadsService removedPayloadsService,
Clock clock,
@Named("MAX_SEQUENCE_NUMBER_MAP_SIZE_BEFORE_PURGE") int maxSequenceNumberBeforePurge) {
this.broadcaster = broadcaster;
@ -173,7 +173,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
this.protectedDataStoreService = protectedDataStoreService;
this.resourceDataStoreService = resourceDataStoreService;
this.persistenceManager = persistenceManager;
this.removedPayloadsStorageService = removedPayloadsStorageService;
this.removedPayloadsService = removedPayloadsService;
this.clock = clock;
this.maxSequenceNumberMapSizeBeforePurge = maxSequenceNumberBeforePurge;
@ -772,7 +772,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
public boolean hasAlreadyRemovedAddOncePayload(ProtectedStoragePayload protectedStoragePayload,
ByteArray hashOfPayload) {
return protectedStoragePayload instanceof AddOncePayload && removedPayloadsStorageService.wasRemoved(hashOfPayload);
return protectedStoragePayload instanceof AddOncePayload && removedPayloadsService.wasRemoved(hashOfPayload);
}
/**
@ -856,7 +856,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener, Pers
// Update that we have seen this AddOncePayload so the next time it is seen it fails verification
if (protectedStoragePayload instanceof AddOncePayload) {
removedPayloadsStorageService.addHash(hashOfPayload);
removedPayloadsService.addHash(hashOfPayload);
}
if (storedEntry != null) {

View File

@ -30,12 +30,12 @@ import lombok.extern.slf4j.Slf4j;
@Singleton
@Slf4j
public class RemovedPayloadsStorageService implements PersistedDataHost {
public class RemovedPayloadsService implements PersistedDataHost {
private final PersistenceManager<RemovedPayloadsMap> persistenceManager;
private final RemovedPayloadsMap removedPayloadsMap = new RemovedPayloadsMap();
@Inject
public RemovedPayloadsStorageService(PersistenceManager<RemovedPayloadsMap> persistenceManager) {
public RemovedPayloadsService(PersistenceManager<RemovedPayloadsMap> persistenceManager) {
this.persistenceManager = persistenceManager;
this.persistenceManager.initialize(removedPayloadsMap, PersistenceManager.Source.PRIVATE_LOW_PRIO);

View File

@ -35,7 +35,7 @@ import bisq.network.p2p.storage.payload.ProtectedMailboxStorageEntry;
import bisq.network.p2p.storage.payload.ProtectedStorageEntry;
import bisq.network.p2p.storage.persistence.AppendOnlyDataStoreListener;
import bisq.network.p2p.storage.persistence.ProtectedDataStoreService;
import bisq.network.p2p.storage.persistence.RemovedPayloadsStorageService;
import bisq.network.p2p.storage.persistence.RemovedPayloadsService;
import bisq.network.p2p.storage.persistence.ResourceDataStoreService;
import bisq.network.p2p.storage.persistence.SequenceNumberMap;
@ -73,12 +73,12 @@ public class TestState {
private final PersistenceManager<SequenceNumberMap> mockSeqNrPersistenceManager;
private final ProtectedDataStoreService protectedDataStoreService;
final ClockFake clockFake;
private RemovedPayloadsStorageService removedPayloadsStorageService;
private RemovedPayloadsService removedPayloadsService;
TestState() {
this.mockBroadcaster = mock(Broadcaster.class);
this.mockSeqNrPersistenceManager = mock(PersistenceManager.class);
this.removedPayloadsStorageService = mock(RemovedPayloadsStorageService.class);
this.removedPayloadsService = mock(RemovedPayloadsService.class);
this.clockFake = new ClockFake();
this.protectedDataStoreService = new ProtectedDataStoreService();
@ -87,7 +87,7 @@ public class TestState {
new AppendOnlyDataStoreServiceFake(),
this.protectedDataStoreService, mock(ResourceDataStoreService.class),
this.mockSeqNrPersistenceManager,
removedPayloadsStorageService,
removedPayloadsService,
this.clockFake,
MAX_SEQUENCE_NUMBER_MAP_SIZE_BEFORE_PURGE);
@ -102,7 +102,7 @@ public class TestState {
this.clockFake,
this.hashMapChangedListener,
this.appendOnlyDataStoreListener,
removedPayloadsStorageService);
removedPayloadsService);
when(this.mockSeqNrPersistenceManager.getPersisted())
.thenReturn(this.mockedStorage.sequenceNumberMap);
@ -115,7 +115,7 @@ public class TestState {
* not running the entire storage code paths.
*/
void simulateRestart() {
this.removedPayloadsStorageService = mock(RemovedPayloadsStorageService.class);
this.removedPayloadsService = mock(RemovedPayloadsService.class);
this.mockedStorage = createP2PDataStorageForTest(
this.mockBroadcaster,
this.protectedDataStoreService,
@ -123,7 +123,7 @@ public class TestState {
this.clockFake,
this.hashMapChangedListener,
this.appendOnlyDataStoreListener,
removedPayloadsStorageService);
removedPayloadsService);
when(this.mockSeqNrPersistenceManager.getPersisted())
.thenReturn(this.mockedStorage.sequenceNumberMap);
@ -136,7 +136,7 @@ public class TestState {
ClockFake clock,
HashMapChangedListener hashMapChangedListener,
AppendOnlyDataStoreListener appendOnlyDataStoreListener,
RemovedPayloadsStorageService removedPayloadsStorageService) {
RemovedPayloadsService removedPayloadsService) {
P2PDataStorage p2PDataStorage = new P2PDataStorage(mock(NetworkNode.class),
broadcaster,
@ -144,7 +144,7 @@ public class TestState {
protectedDataStoreService,
mock(ResourceDataStoreService.class),
sequenceNrMapPersistenceManager,
removedPayloadsStorageService,
removedPayloadsService,
clock,
MAX_SEQUENCE_NUMBER_MAP_SIZE_BEFORE_PURGE);