java.lang.Object
org.forgerock.opendj.server.leaderbasedreplication.Topology

public class Topology extends Object
Represents the topology of the replication domain.

The topology is a snapshot of the current state of the replication domain. It contains the list of replicas and their coordinates, as well as the domain state.

  • Constructor Details

    • Topology

      public Topology(Map<ReplicaId,Topology.ReplicaInfo> replicas, Topology.DomainState domainState)
      Constructor of a new Topology.
      Parameters:
      replicas - the information of replicas participating in the topology
      domainState - the current state of the domain
  • Method Details

    • getReplicas

      public Map<ReplicaId,Topology.ReplicaInfo> getReplicas()
      Returns the information of replicas participating in the topology.
      Returns:
      the information of replicas participating in the topology.
    • getDomainState

      public Topology.DomainState getDomainState()
      Returns the current state of the domain.
      Returns:
      the current state of the domain.
    • getReplicasToFetchFrom

      public Set<ReplicaId> getReplicasToFetchFrom(ReplicaId fetchingReplica)
      Returns the set of replica IDs from which the specified fetching replica should fetch changes.

      A replica must always fetch changes from all replicas in the same location. Additionally, if the replica is the leader of a location branch level, it must also fetch changes from the leaders of location branch levels with the same parent branch level.

      The leader is the replica with the minimum replica ID amongst the replicas in the same location branch level.

      Parameters:
      fetchingReplica - the ID of the replica that is fetching changes
      Returns:
      a set of replica IDs from which the specified fetching replica should fetch changes
      See Also:
      • for more information about location branch levels and leaders computation
    • getReplicasToFetchInsteadOf

      public Set<ReplicaId> getReplicasToFetchInsteadOf(ReplicaId unreachableReplica, ReplicaId fetchingReplica)
      Returns the set of replica IDs from which the specified fetching replica should fetch changes instead of the unreachable replica.

      If the unreachable replica is the leader of a location branch level, the fetching replica should fetch from the next leader of that location branch level instead. If the fetching replica is the new leader for that location branch level, it must behave as the leader and fetch from leaders of location branch levels with the same parent.

      The leader is defined as the replica with the lowest replica ID amongst the replicas in the same location branch level.

      Parameters:
      unreachableReplica - the ID of the unreachable replica
      fetchingReplica - the ID of the replica that is fetching changes
      Returns:
      a set of replica IDs from which the specified fetching replica should fetch changes instead of the unreachable replica
      See Also:
      • for more information about location branch levels and leaders computation