All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quorum.tessera.p2p.partyinfo.SimplePartyStore Maven / Gradle / Ivy

Go to download

Tessera is a stateless Java system that is used to enable the encryption, decryption, and distribution of private transactions for Quorum.

There is a newer version: 24.4.2
Show newest version
package com.quorum.tessera.p2p.partyinfo;

import com.quorum.tessera.discovery.NodeUri;
import java.net.URI;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

enum SimplePartyStore implements PartyStore {
  INSTANCE;

  private static final Logger LOGGER = LoggerFactory.getLogger(SimplePartyStore.class);

  private final SortedSet parties = new ConcurrentSkipListSet<>();

  @Override
  public Set getParties() {
    LOGGER.debug("Fetching parties {}", Objects.toString(parties));

    return Set.copyOf(parties);
  }

  @Override
  public PartyStore store(URI party) {
    NodeUri nodeUri = NodeUri.create(party);
    LOGGER.debug("Store {}", nodeUri.asURI());
    parties.add(nodeUri.asURI());
    return this;
  }

  @Override
  public PartyStore remove(URI party) {
    NodeUri nodeUri = NodeUri.create(party);
    LOGGER.debug("Remove {}", nodeUri.asURI());
    parties.remove(nodeUri.asURI());
    return this;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy