Class StateStoreUtils

java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.StateStoreUtils

public final class StateStoreUtils extends Object
Set of utility functions used to work with the State Store.
  • Method Details

    • getRecordClass

      public static <T extends BaseRecord> Class<? extends BaseRecord> getRecordClass(Class<T> clazz)
      Get the base class for a record class. If we get an implementation of a record we will return the real parent record class.
      Type Parameters:
      T - Type of the class of the data record to check.
      Parameters:
      clazz - Class of the data record to check.
      Returns:
      Base class for the record.
    • getRecordClass

      public static <T extends BaseRecord> Class<? extends BaseRecord> getRecordClass(T record)
      Get the base class for a record. If we get an implementation of a record we will return the real parent record class.
      Type Parameters:
      T - Type of the class of the data record.
      Parameters:
      record - Record to check its main class.
      Returns:
      Base class for the record.
    • getRecordName

      public static <T extends BaseRecord> String getRecordName(Class<T> clazz)
      Get the base class name for a record. If we get an implementation of a record we will return the real parent record class.
      Type Parameters:
      T - Type of the class of the data record.
      Parameters:
      clazz - Class of the data record to check.
      Returns:
      Name of the base class for the record.
    • filterMultiple

      public static <T extends BaseRecord> List<T> filterMultiple(Query<T> query, Iterable<T> records)
      Filters a list of records to find all records matching the query.
      Type Parameters:
      T - Type of the class of the data record.
      Parameters:
      query - Map of field names and objects to use to filter results.
      records - List of data records to filter.
      Returns:
      List of all records matching the query (or empty list if none match), null if the data set could not be filtered.
    • getHostPortString

      public static String getHostPortString(InetSocketAddress address)
      Returns address in form of host:port, empty string if address is null.
      Parameters:
      address - address
      Returns:
      host:port
    • getIpPortString

      public static String getIpPortString(InetSocketAddress address)
      Returns address in form of ip:port, empty string if address is null.
      Parameters:
      address - address
      Returns:
      host:port