Class HelixVcrCluster

  • All Implemented Interfaces:
    com.github.ambry.clustermap.VirtualReplicatorCluster, java.lang.AutoCloseable

    public class HelixVcrCluster
    extends java.lang.Object
    implements com.github.ambry.clustermap.VirtualReplicatorCluster
    Helix Based VCR Cluster.
    • Constructor Summary

      Constructors 
      Constructor Description
      HelixVcrCluster​(com.github.ambry.config.CloudConfig cloudConfig, com.github.ambry.config.ClusterMapConfig clusterMapConfig, com.github.ambry.config.StoreConfig storeConfig, com.github.ambry.clustermap.ClusterMap clusterMap, com.github.ambry.account.AccountService accountService, CloudDestination cloudDestination, VcrMetrics vcrMetrics)
      Construct the helix VCR cluster.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(com.github.ambry.clustermap.VirtualReplicatorClusterListener listener)  
      void addPartition​(java.lang.String partitionIdStr)
      Add PartitionId to assignedPartitionIds set, if {@param partitionIdStr} valid.
      void close()  
      java.util.List<? extends com.github.ambry.clustermap.DataNodeId> getAllDataNodeIds()  
      java.util.Collection<? extends com.github.ambry.clustermap.PartitionId> getAssignedPartitionIds()  
      com.github.ambry.clustermap.DataNodeId getCurrentDataNodeId()  
      boolean isPartitionAssigned​(java.lang.String partitionPath)  
      void participate()  
      void removePartition​(java.lang.String partitionIdStr)
      Remove PartitionId from assignedPartitionIds set, if {@param partitionIdStr} valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HelixVcrCluster

        public HelixVcrCluster​(com.github.ambry.config.CloudConfig cloudConfig,
                               com.github.ambry.config.ClusterMapConfig clusterMapConfig,
                               com.github.ambry.config.StoreConfig storeConfig,
                               com.github.ambry.clustermap.ClusterMap clusterMap,
                               com.github.ambry.account.AccountService accountService,
                               CloudDestination cloudDestination,
                               VcrMetrics vcrMetrics)
        Construct the helix VCR cluster.
        Parameters:
        cloudConfig - The cloud configuration to use.
        clusterMapConfig - The clusterMap configuration to use.
        clusterMap - The clusterMap to use.
        vcrMetrics - VcrMetrics object.
    • Method Detail

      • addPartition

        public void addPartition​(java.lang.String partitionIdStr)
        Add PartitionId to assignedPartitionIds set, if {@param partitionIdStr} valid. Used in one of the vcr state model classes OnlineOfflineHelixVcrStateModel or LeaderStandbyHelixVcrStateModel if current VCR is assigned a partition.
        Parameters:
        partitionIdStr - The partitionIdStr notified by Helix.
      • removePartition

        public void removePartition​(java.lang.String partitionIdStr)
        Remove PartitionId from assignedPartitionIds set, if {@param partitionIdStr} valid. Used in one of the vcr state model classes OnlineOfflineHelixVcrStateModel or LeaderStandbyHelixVcrStateModel if current VCR becomes offline for a partition.
        Parameters:
        partitionIdStr - The partitionIdStr notified by Helix.
      • getAllDataNodeIds

        public java.util.List<? extends com.github.ambry.clustermap.DataNodeId> getAllDataNodeIds()
        Specified by:
        getAllDataNodeIds in interface com.github.ambry.clustermap.VirtualReplicatorCluster
      • getCurrentDataNodeId

        public com.github.ambry.clustermap.DataNodeId getCurrentDataNodeId()
        Specified by:
        getCurrentDataNodeId in interface com.github.ambry.clustermap.VirtualReplicatorCluster
      • participate

        public void participate()
                         throws java.lang.Exception
        Specified by:
        participate in interface com.github.ambry.clustermap.VirtualReplicatorCluster
        Throws:
        java.lang.Exception
      • getAssignedPartitionIds

        public java.util.Collection<? extends com.github.ambry.clustermap.PartitionId> getAssignedPartitionIds()
        Specified by:
        getAssignedPartitionIds in interface com.github.ambry.clustermap.VirtualReplicatorCluster
      • isPartitionAssigned

        public boolean isPartitionAssigned​(java.lang.String partitionPath)
        Specified by:
        isPartitionAssigned in interface com.github.ambry.clustermap.VirtualReplicatorCluster
      • addListener

        public void addListener​(com.github.ambry.clustermap.VirtualReplicatorClusterListener listener)
        Specified by:
        addListener in interface com.github.ambry.clustermap.VirtualReplicatorCluster
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable