Package org.apache.druid.discovery
Class NodeRole
- java.lang.Object
-
- org.apache.druid.discovery.NodeRole
-
public class NodeRole extends Object
Defines the 'role' of a Druid service, utilized to strongly type announcement and service discovery. Originally, this was an enum to add type safety for discovery and announcement purposes, but was expanded into a class to allow for extensibility while retaining the type safety of using defined types instead of raw strings. As such, this class tries to mimic the interface provided by the previous enum. Built in node roles define anamethat is distinct fromjsonName, and is the previous value which would occur when the enum was used in a 'toString' context. Custom node roles allow extension to participate in announcement and discovery, but are limited to only usingjsonNamefor both toString and JSON serde. The historical context of why the enum was different fromServerType(also called "node type" in various places) is because while they are essentially the same abstraction, merging them could only increase the complexity and drop the code safety, because they name the same types differently ("peon" - "indexer-executor" and "middleManager" - "realtime") and both expose them via JSON APIs. These abstractions can all potentially be merged when Druid updates to Jackson 2.9 that supports JsonAliases, see https://github.com/apache/druid/issues/7152.
-
-
Field Summary
Fields Modifier and Type Field Description static NodeRoleBROKERstatic StringBROKER_JSON_NAMEstatic NodeRoleCOORDINATORstatic StringCOORDINATOR_JSON_NAMEstatic NodeRoleHISTORICALstatic StringHISTORICAL_JSON_NAMEstatic NodeRoleINDEXERstatic StringINDEXER_JSON_NAMEstatic NodeRoleMIDDLE_MANAGERstatic StringMIDDLE_MANAGER_JSON_NAMEstatic NodeRoleOVERLORDstatic StringOVERLORD_JSON_NAMEstatic NodeRolePEONstatic StringPEON_JSON_NAMEstatic NodeRoleROUTERstatic StringROUTER_JSON_NAME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static NodeRolefromJsonName(String jsonName)com.google.inject.name.NamedgetDruidServiceInjectName()StringgetJsonName()inthashCode()StringtoString()static NodeRole[]values()built-in node roles
-
-
-
Field Detail
-
COORDINATOR_JSON_NAME
public static final String COORDINATOR_JSON_NAME
- See Also:
- Constant Field Values
-
HISTORICAL_JSON_NAME
public static final String HISTORICAL_JSON_NAME
- See Also:
- Constant Field Values
-
BROKER_JSON_NAME
public static final String BROKER_JSON_NAME
- See Also:
- Constant Field Values
-
OVERLORD_JSON_NAME
public static final String OVERLORD_JSON_NAME
- See Also:
- Constant Field Values
-
PEON_JSON_NAME
public static final String PEON_JSON_NAME
- See Also:
- Constant Field Values
-
ROUTER_JSON_NAME
public static final String ROUTER_JSON_NAME
- See Also:
- Constant Field Values
-
MIDDLE_MANAGER_JSON_NAME
public static final String MIDDLE_MANAGER_JSON_NAME
- See Also:
- Constant Field Values
-
INDEXER_JSON_NAME
public static final String INDEXER_JSON_NAME
- See Also:
- Constant Field Values
-
COORDINATOR
public static final NodeRole COORDINATOR
-
HISTORICAL
public static final NodeRole HISTORICAL
-
BROKER
public static final NodeRole BROKER
-
OVERLORD
public static final NodeRole OVERLORD
-
PEON
public static final NodeRole PEON
-
ROUTER
public static final NodeRole ROUTER
-
MIDDLE_MANAGER
public static final NodeRole MIDDLE_MANAGER
-
INDEXER
public static final NodeRole INDEXER
-
-
Constructor Detail
-
NodeRole
public NodeRole(String jsonName)
Create a custom node role. Known Druid node roles should ALWAYS use the built-in static node roles: (COORDINATOR,OVERLORD,ROUTER,BROKERINDEXER,MIDDLE_MANAGER,HISTORICAL) instead of constructing a new instance.
-
-