Interface ClusterParticipant

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface ClusterParticipant
    extends java.lang.AutoCloseable
    A ClusterParticipant is a component that makes up the Ambry cluster.
    • Method Detail

      • participate

        void participate​(java.util.List<AmbryHealthReport> ambryHealthReports,
                         AccountStatsStore accountStatsStore,
                         Callback<StatsSnapshot> callback)
                  throws java.io.IOException
        Initiate the participation of cluster participant.
        Parameters:
        ambryHealthReports - List of AmbryHealthReport to be registered to the participant.
        accountStatsStore - The AccountStatsStore to retrieve and store container stats.
        callback - a callback which will be invoked when the aggregation report has been generated successfully.
        Throws:
        java.io.IOException
      • setReplicaSealedState

        boolean setReplicaSealedState​(ReplicaId replicaId,
                                      boolean isSealed)
        Set or reset the sealed state of the given replica.
        Parameters:
        replicaId - the ReplicaId whose sealed state will be updated.
        isSealed - if true, the replica will be marked as sealed; otherwise it will be marked as read-write.
        Returns:
        true if set replica sealed state was successful. false if not.
      • setReplicaStoppedState

        boolean setReplicaStoppedState​(java.util.List<ReplicaId> replicaIds,
                                       boolean markStop)
        Set or reset the stopped state of the given replica.
        Parameters:
        replicaIds - a list of replicas whose stopped state will be updated
        markStop - if true, the replica will be marked as stopped; otherwise it will be marked as started.
        Returns:
        true if set replica stopped state was successful. false if not.
      • setReplicaDisabledState

        default void setReplicaDisabledState​(ReplicaId replicaId,
                                             boolean disable)
        Set or reset the disabled state of the given replica
        Parameters:
        replicaId - the ReplicaId whose disabled state will be updated.
      • getSealedReplicas

        java.util.List<java.lang.String> getSealedReplicas()
        Get a list of replicas that are marked as sealed (read-only).
        Returns:
        a list of all sealed replicas.
      • getStoppedReplicas

        java.util.List<java.lang.String> getStoppedReplicas()
        Get a list of replicas that are marked as stopped.
        Returns:
        a list of all stopped replicas.
      • getDisabledReplicas

        default java.util.List<java.lang.String> getDisabledReplicas()
        Get a list of replicas that have been disabled.
        Returns:
        a list of all disabled replicas.
      • registerPartitionStateChangeListener

        void registerPartitionStateChangeListener​(StateModelListenerType listenerType,
                                                  PartitionStateChangeListener partitionStateChangeListener)
        Register a listener for leadership changes in partitions of this node.
        Parameters:
        listenerType - the type of listener, which is defined in StateModelListenerType
        partitionStateChangeListener - listener to register.
      • updateDataNodeInfoInCluster

        boolean updateDataNodeInfoInCluster​(ReplicaId replicaId,
                                            boolean shouldExist)
        Update disk/replica infos associated with current data node in cluster (this occurs when replica addition/removal on current node is complete and local changes will be broadcast to all listeners in this cluster)
        Parameters:
        replicaId - the ReplicaId whose info should be updated on current node
        shouldExist - Whether the replica info should exist or not. When true, replica info will be added if it is missing in current node info. When false, replica info will be removed if present.
        Returns:
        if true, node info is successfully updated. false otherwise.
      • setInitialLocalPartitions

        default void setInitialLocalPartitions​(java.util.Collection<java.lang.String> localPartitions)
        Set initial local partitions that the cluster participant hosts.
        Parameters:
        localPartitions - a collection of initial local partitions.
      • resetPartitionState

        default boolean resetPartitionState​(java.lang.String partitionName)
        Reset given partition to initial state.
        Parameters:
        partitionName - the partition to reset.
        Returns:
        whether reset operation succeeded or not.
      • supportsStateChanges

        default boolean supportsStateChanges()
        Returns:
        true if this participant supports dynamic partition state changes.
      • close

        void close()
        Terminate the participant.
        Specified by:
        close in interface java.lang.AutoCloseable