org.apache.cassandra.locator

## Class YamlFileNetworkTopologySnitch

- java.lang.Object
- - org.apache.cassandra.locator.AbstractEndpointSnitch
  - - org.apache.cassandra.locator.AbstractNetworkTopologySnitch
    - - org.apache.cassandra.locator.YamlFileNetworkTopologySnitch

- All Implemented Interfaces:
    IEndpointSnitch

      public class YamlFileNetworkTopologySnitch
      extends AbstractNetworkTopologySnitch

  Network topology snitch that reads its configuration from a YAML file.

  This snitch supports connections over preferred addresses, such as a data-center-local address, based on the reconnection trick used in `Ec2MultiRegionSnitch`. The configuration file, `cassandra-topology.yaml`, is checked periodically for updates.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `YamlFileNetworkTopologySnitch.Datacenter` Data center object type for the YAML topology configuration.
    `static class` | `YamlFileNetworkTopologySnitch.Node` Node object type for the YAML topology configuration.
    `static class` | `YamlFileNetworkTopologySnitch.Rack` Rack object type for the YAML topology configuration.
    `static class` | `YamlFileNetworkTopologySnitch.TopologyConfig` Root object type for the YAML topology configuration.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `YamlFileNetworkTopologySnitch()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDatacenter(java.net.InetAddress endpoint)` Returns the name of the data center for the endpoint, or `UNKNOWN` if not known.
    `java.lang.String` | `getRack(java.net.InetAddress endpoint)` Returns the name of the rack for the endpoint, or `UNKNOWN` if not known.
    `void` | `gossiperStarting()` Called in preparation for the initiation of the gossip loop.

    - ### Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch

      `compareEndpoints`

    - ### Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch

      `getSortedListByProximity, isWorthMergingForRangeQuery, sortByProximity`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### YamlFileNetworkTopologySnitch

          public YamlFileNetworkTopologySnitch()
                                        throws ConfigurationException

      Constructor.
      Throws:
        `ConfigurationException` - on failure

  - ### Method Detail

    - #### getRack

          public java.lang.String getRack(java.net.InetAddress endpoint)

      Returns the name of the rack for the endpoint, or `UNKNOWN` if not known.
      Specified by:
        `getRack` in interface `IEndpointSnitch`
      Specified by:
        `getRack` in class `AbstractNetworkTopologySnitch`
      Parameters:
        `endpoint` - a specified endpoint
      Returns:
        the name of the data center for the endpoint, or `UNKNOWN` if not known

    - #### getDatacenter

          public java.lang.String getDatacenter(java.net.InetAddress endpoint)

      Returns the name of the data center for the endpoint, or `UNKNOWN` if not known.
      Specified by:
        `getDatacenter` in interface `IEndpointSnitch`
      Specified by:
        `getDatacenter` in class `AbstractNetworkTopologySnitch`
      Parameters:
        `endpoint` - a specified endpoint
      Returns:
        the name of the data center for the endpoint, or `UNKNOWN` if not known

    - #### gossiperStarting

          public void gossiperStarting()

      Called in preparation for the initiation of the gossip loop.
      Specified by:
        `gossiperStarting` in interface `IEndpointSnitch`
      Overrides:
        `gossiperStarting` in class `AbstractEndpointSnitch`

Copyright © 2014 The Apache Software Foundation