Interface ClusterChangeHandler

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<com.github.ambry.clustermap.AmbryDataNode> getAllDataNodes()  
      com.github.ambry.clustermap.AmbryDataNode getDataNode​(java.lang.String instanceName)
      Get ambry data node associated with given instance name.
      java.util.Map<com.github.ambry.clustermap.AmbryDataNode,​java.util.Set<com.github.ambry.clustermap.AmbryDisk>> getDataNodeToDisksMap()  
      java.util.Set<com.github.ambry.clustermap.AmbryDisk> getDisks​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode)
      Get all disks belong to given data node.
      long getErrorCount()  
      java.util.Map<java.lang.String,​java.lang.String> getPartitionToResourceMap()  
      AmbryReplica getReplicaId​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode, java.lang.String partitionName)
      Get AmbryReplica on given node that belongs to specified partition.
      java.util.List<AmbryReplica> getReplicaIds​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode)
      Get all replicas on given node.
      java.util.stream.Stream<AmbryReplica> getReplicaIdsByState​(AmbryPartition partition, com.github.ambry.clustermap.ReplicaState state)
      Get replicas of given partition from this datacenter that are in required state
      void registerClusterMapListener​(com.github.ambry.clustermap.ClusterMapChangeListener clusterMapChangeListener)
      Register a listener of cluster map for any changes.
    • Method Detail

      • registerClusterMapListener

        void registerClusterMapListener​(com.github.ambry.clustermap.ClusterMapChangeListener clusterMapChangeListener)
        Register a listener of cluster map for any changes.
        Parameters:
        clusterMapChangeListener - the ClusterMapChangeListener to add.
      • getReplicaIdsByState

        java.util.stream.Stream<AmbryReplica> getReplicaIdsByState​(AmbryPartition partition,
                                                                   com.github.ambry.clustermap.ReplicaState state)
        Get replicas of given partition from this datacenter that are in required state
        Parameters:
        partition - the PartitionId for which to get the list of replicas.
        state - ReplicaState associated with replica
        Returns:
        the ReplicaIds satisfying requirements.
      • getDataNodeToDisksMap

        java.util.Map<com.github.ambry.clustermap.AmbryDataNode,​java.util.Set<com.github.ambry.clustermap.AmbryDisk>> getDataNodeToDisksMap()
        Returns:
        a map from ambry data node to its disks.
      • getDataNode

        com.github.ambry.clustermap.AmbryDataNode getDataNode​(java.lang.String instanceName)
        Get ambry data node associated with given instance name.
        Parameters:
        instanceName - associated with ambry node.
        Returns:
        requested AmbryDataNode
      • getReplicaId

        AmbryReplica getReplicaId​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode,
                                  java.lang.String partitionName)
        Get AmbryReplica on given node that belongs to specified partition.
        Parameters:
        ambryDataNode - the node on which the replica resides.
        partitionName - name of partition which the replica belongs to.
        Returns:
        requested AmbryReplica
      • getReplicaIds

        java.util.List<AmbryReplica> getReplicaIds​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode)
        Get all replicas on given node.
        Parameters:
        ambryDataNode - the node on which replicas reside
        Returns:
        a list of AmbryReplica on given node.
      • getAllDataNodes

        java.util.List<com.github.ambry.clustermap.AmbryDataNode> getAllDataNodes()
        Returns:
        all AmbryDataNode tracked by this ClusterChangeHandler
      • getDisks

        java.util.Set<com.github.ambry.clustermap.AmbryDisk> getDisks​(com.github.ambry.clustermap.AmbryDataNode ambryDataNode)
        Get all disks belong to given data node.
        Parameters:
        ambryDataNode - the node which the disks belong to.
        Returns:
        a set of AmbryDisk that belongs to given node.
      • getPartitionToResourceMap

        java.util.Map<java.lang.String,​java.lang.String> getPartitionToResourceMap()
        Returns:
        a map from partition name to its corresponding resource name in this ClusterChangeHandler.
      • getErrorCount

        long getErrorCount()
        Returns:
        number of errors occurred during handling cluster changes.