/*
 * This file is part of Bisq.
 *
 * Bisq is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bisq is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bisq. If not, see <http://www.gnu.org/licenses/>.
 */

package bisq.network.p2p.storage.persistence;

import bisq.network.p2p.storage.P2PDataStorage;
import bisq.network.p2p.storage.payload.PersistableNetworkPayload;

import bisq.common.proto.persistable.PersistableEnvelope;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import lombok.Getter;

/**
 *  Base class for store implementations using a map with a PersistableNetworkPayload
 *  as the type of the map value.
 */
public abstract class PersistableNetworkPayloadStore implements PersistableEnvelope {
    @Getter
    public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> map = new ConcurrentHashMap<>();
}

@@ -893,24 +893,53 @@
 eEnvelope;%0A%0A
+import java.util.Collection;%0A
 import java.
@@ -1022,136 +1022,137 @@
 er;%0A
-%0A/**%0A *  Base class for store implementations using a map with a PersistableNetworkPayload%0A *  as the type of the map value.%0A */
+import lombok.extern.slf4j.Slf4j;%0A%0A%0A/**%0A * Store for PersistableNetworkPayload map entries with it's data hash as key.%0A */%0A@Slf4j
 %0Apub
@@ -1200,16 +1200,53 @@
 oadStore
+%3CT extends PersistableNetworkPayload%3E
  impleme
@@ -1288,21 +1288,30 @@
 er%0A    p
-ublic
+rotected final
  Map%3CP2P
@@ -1392,11 +1392,353 @@
 Map%3C%3E();
+%0A%0A    protected PersistableNetworkPayloadStore() %7B%0A    %7D%0A%0A    protected PersistableNetworkPayloadStore(Collection%3CT%3E collection) %7B%0A        collection.forEach(item -%3E map.put(new P2PDataStorage.ByteArray(item.getHash()), item));%0A    %7D%0A%0A    public boolean containsKey(P2PDataStorage.ByteArray hash) %7B%0A        return map.containsKey(hash);%0A    %7D
 %0A%7D%0A

Update PersistableNetworkPayloadStore