Class MastershipInfo


  • public final class MastershipInfo
    extends java.lang.Object
    Mastership info.
    • Constructor Detail

      • MastershipInfo

        public MastershipInfo()
      • MastershipInfo

        public MastershipInfo​(long term,
                              java.util.Optional<NodeId> master,
                              com.google.common.collect.ImmutableMap<NodeId,​MastershipRole> roles)
    • Method Detail

      • term

        public long term()
        Returns the mastership term.
        Returns:
        the mastership term
      • master

        public java.util.Optional<NodeId> master()
        Returns the current master.
        Returns:
        the current master
      • backups

        public java.util.List<NodeId> backups()
        Returns a sorted list of standby nodes.
        Returns:
        a sorted list of standby nodes
      • getRoles

        public java.util.List<NodeId> getRoles​(MastershipRole role)
        Returns the list of nodes with the given role.
        Parameters:
        role - the role by which to filter nodes
        Returns:
        an immutable list of nodes with the given role sorted in priority order
      • getRole

        public MastershipRole getRole​(NodeId nodeId)
        Returns the current role for the given node.
        Parameters:
        nodeId - the node for which to return the current role
        Returns:
        the current role for the given node
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object