/*
 * Copyright DataStax, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.datastax.oss.driver.api.core.metadata;

import com.datastax.oss.driver.api.core.loadbalancing.LoadBalancingPolicy;
import com.datastax.oss.driver.internal.core.metadata.TopologyEvent;
import java.net.InetSocketAddress;

/** The state of a node, as viewed from the driver. */
public enum NodeState {
  /**
   * The driver has never tried to connect to the node, nor received any topology events about it.
   *
   * <p>This happens when nodes are first added to the cluster, and will persist if your {@link
   * LoadBalancingPolicy} decides to ignore them. Since the driver does not connect to them, the
   * only way it can assess their states is from topology events.
   */
  UNKNOWN,
  /**
   * A node is considered up in either of the following situations:
   *
   * <ul>
   *   <li>the driver has at least one active connection to the node.
   *   <li>the driver is not actively trying to connect to the node (because it's ignored by the
   *       {@link LoadBalancingPolicy}), but it has received a topology event indicating that the
   *       node is up.
   * </ul>
   */
  UP,
  /**
   * A node is considered down in either of the following situations:
   *
   * <ul>
   *   <li>the driver has lost all connections to the node (and is currently trying to reconnect).
   *   <li>the driver is not actively trying to connect to the node (because it's ignored by the
   *       {@link LoadBalancingPolicy}), but it has received a topology event indicating that the
   *       node is down.
   * </ul>
   */
  DOWN,
  /**
   * The node was forced down externally, the driver will never try to reconnect to it, whatever the
   * {@link LoadBalancingPolicy} says.
   *
   * <p>This is used for edge error cases, for example when the driver detects that it's trying to
   * connect to a node that does not belong to the Cassandra cluster (e.g. a wrong address was
   * provided in the contact points). It can also be {@link
   * TopologyEvent#forceDown(InetSocketAddress) triggered explicitly} by components (for example a
   * custom load balancing policy) that want to limit the number of nodes that the driver connects
   * to.
   */
  FORCED_DOWN,
}

@@ -1356,35 +1356,12 @@
 ons:
-%0A   *%0A   * %3Cul%3E%0A   *   %3Cli%3E
+ 1) 
 the 
@@ -1383,16 +1383,21 @@
 east one
+%0A   *
  active 
@@ -1418,29 +1418,24 @@
 the node
-.%0A   *   %3Cli%3E
+, or 2) 
 the driv
@@ -1474,32 +1474,37 @@
 nect to the node
+%0A   *
  (because it's i
@@ -1512,35 +1512,24 @@
 nored by the
-%0A   *      
  %7B@link Load
@@ -1575,32 +1575,37 @@
 a topology event
+%0A   *
  indicating that
@@ -1604,35 +1604,24 @@
 ing that the
-%0A   *      
  node is up.
@@ -1621,27 +1621,16 @@
  is up.%0A
-   * %3C/ul%3E%0A
    */%0A  
@@ -1712,35 +1712,12 @@
 ons:
-%0A   *%0A   * %3Cul%3E%0A   *   %3Cli%3E
+ 1) 
 the 
@@ -1735,16 +1735,21 @@
 lost all
+%0A   *
  connect
@@ -1807,21 +1807,16 @@
 ect)
-.%0A   *   %3Cli%3E
+, or 2) 
 the 
@@ -1820,32 +1820,37 @@
 he driver is not
+%0A   *
  actively trying
@@ -1905,26 +1905,20 @@
  the
-%0A   *      
  %7B@link
+%0A   *
  Loa
@@ -1997,19 +1997,8 @@
  the
-%0A   *      
  nod
@@ -2012,19 +2012,8 @@
 wn.%0A
-   * %3C/ul%3E%0A
    *

Reformat NodeState javadocs