Interface LeadershipStore

    • Method Detail

      • addRegistration

        Leadership addRegistration​(java.lang.String topic)
        Adds registration for the local instance to be part of the leadership contest for topic.
        Parameters:
        topic - leadership topic
        Returns:
        Updated leadership after operation is completed
      • removeRegistration

        void removeRegistration​(java.lang.String topic)
        Unregisters the local instance from leadership contest for topic.
        Parameters:
        topic - leadership topic
      • removeRegistration

        void removeRegistration​(NodeId nodeId)
        Unregisters an instance from all leadership contests.
        Parameters:
        nodeId - node identifier
      • moveLeadership

        boolean moveLeadership​(java.lang.String topic,
                               NodeId toNodeId)
        Updates state so that given node is leader for a topic.
        Parameters:
        topic - leadership topic
        toNodeId - identifier of the desired leader
        Returns:
        true if the transfer succeeded; false otherwise. This method can return false if the node is not registered for the topic
      • makeTopCandidate

        boolean makeTopCandidate​(java.lang.String topic,
                                 NodeId nodeId)
        Attempts to make a node the top candidate.
        Parameters:
        topic - leadership topic
        nodeId - node identifier
        Returns:
        true if the specified node is now the top candidate. This method will return false if the node is not registered for the topic
      • getLeadership

        Leadership getLeadership​(java.lang.String topic)
        Returns the current leadership for topic.
        Parameters:
        topic - leadership topic
        Returns:
        current leadership
      • getLeaderships

        java.util.Map<java.lang.String,​Leadership> getLeaderships()
        Return current leadership for all topics.
        Returns:
        topic to leadership mapping