| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013 ForgeRock AS |
| | | * Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.types.DN; |
| | | |
| | | /** |
| | |
| | | private final Map<DN, Long> domainToGenerationId = new HashMap<DN, Long>(); |
| | | private final Map<DN, List<Integer>> domainToServerIds = |
| | | new HashMap<DN, List<Integer>>(); |
| | | private final Map<DN, List<CSN>> offlineReplicas = |
| | | new HashMap<DN, List<CSN>>(); |
| | | |
| | | /** |
| | | * Sets the generationId for the supplied replication domain. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Adds the following replica information to the offline list. |
| | | * |
| | | * @param baseDN |
| | | * the baseDN of the offline replica |
| | | * @param offlineCSN |
| | | * the CSN (serverId + timestamp) of the offline replica |
| | | */ |
| | | public void addOfflineReplica(DN baseDN, CSN offlineCSN) |
| | | { |
| | | List<CSN> offlineCSNs = offlineReplicas.get(baseDN); |
| | | if (offlineCSNs == null) |
| | | { |
| | | offlineCSNs = new LinkedList<CSN>(); |
| | | offlineReplicas.put(baseDN, offlineCSNs); |
| | | } |
| | | offlineCSNs.add(offlineCSN); |
| | | } |
| | | |
| | | /** |
| | | * Returns the Map of domainBaseDN => generationId. |
| | | * |
| | | * @return a Map of domainBaseDN => generationId |
| | |
| | | return domainToServerIds; |
| | | } |
| | | |
| | | /** |
| | | * Returns the Map of domainBaseDN => List<offlineCSN>. |
| | | * |
| | | * @return a Map of domainBaseDN => List<offlineCSN>. |
| | | */ |
| | | public Map<DN, List<CSN>> getOfflineReplicas() |
| | | { |
| | | return offlineReplicas; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "domainToGenerationId=" + domainToGenerationId |
| | | + ", domainToServerIds=" + domainToServerIds; |
| | | + ", domainToServerIds=" + domainToServerIds |
| | | + ", offlineReplicas=" + offlineReplicas; |
| | | } |
| | | } |