Class StateStoreUtils
java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.StateStoreUtils
Set of utility functions used to work with the State Store.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends BaseRecord>
List<T>filterMultiple(Query<T> query, Iterable<T> records) Filters a list of records to find all records matching the query.static StringgetHostPortString(InetSocketAddress address) Returns address in form of host:port, empty string if address is null.static StringgetIpPortString(InetSocketAddress address) Returns address in form of ip:port, empty string if address is null.static <T extends BaseRecord>
Class<? extends BaseRecord>getRecordClass(Class<T> clazz) Get the base class for a record class.static <T extends BaseRecord>
Class<? extends BaseRecord>getRecordClass(T record) Get the base class for a record.static <T extends BaseRecord>
StringgetRecordName(Class<T> clazz) Get the base class name for a record.
-
Method Details
-
getRecordClass
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
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
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
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
Returns address in form of host:port, empty string if address is null.- Parameters:
address- address- Returns:
- host:port
-
getIpPortString
Returns address in form of ip:port, empty string if address is null.- Parameters:
address- address- Returns:
- host:port
-