Class Topology
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the location of a replica.static final recordRepresents the coordinates of a replica.static final recordThe information of a replica returned by the topology. -
Constructor Summary
ConstructorsConstructorDescriptionTopology(Map<ReplicaId, Topology.ReplicaInfo> replicas) Constructor of a new Topology. -
Method Summary
Modifier and TypeMethodDescriptionReturns the information of replicas participating in the topology.getReplicasToFetchFrom(ReplicaId fetchingReplica) Returns the set of replica coordinates from which the specified fetching replica should fetch changes.getReplicasToFetchInsteadOf(ReplicaId unreachableReplica, ReplicaId fetchingReplica) Returns the set of replica coordinates from which the specified fetching replica should fetch changes instead of the unreachable replica.toString()
-
Constructor Details
-
Topology
Constructor of a new Topology.- Parameters:
replicas- the information of replicas participating in the topology
-
-
Method Details
-
toString
-
getReplicas
Returns the information of replicas participating in the topology.- Returns:
- the information of replicas participating in the topology
-
getReplicasToFetchFrom
Returns the set of replica coordinates 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 coordinates from which the specified fetching replica should fetch changes
- See Also:
-
getReplicasToFetchInsteadOf
public Set<Topology.ReplicaCoordinate> getReplicasToFetchInsteadOf(ReplicaId unreachableReplica, ReplicaId fetchingReplica) Returns the set of replica coordinates 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 replicafetchingReplica- the ID of the replica that is fetching changes- Returns:
- a set of replica coordinates from which the specified fetching replica should fetch changes instead of the unreachable replica
- See Also:
-