Class TimeRoutedAlias
- java.lang.Object
-
- org.apache.solr.cloud.api.collections.TimeRoutedAlias
-
- All Implemented Interfaces:
RoutedAlias
public class TimeRoutedAlias extends Object implements RoutedAlias
Holds configuration for a routed alias, and some common code and constants.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.cloud.api.collections.RoutedAlias
RoutedAlias.SupportedRouterTypes
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>
OPTIONAL_ROUTER_PARAMS
Optional parameters for creating a routed alias excluding parameters for collection creation.static Set<String>
REQUIRED_ROUTER_PARAMS
Parameters required for creating a routed aliasstatic String
ROUTER_AUTO_DELETE_AGE
static String
ROUTER_INTERVAL
static String
ROUTER_MAX_FUTURE
static String
ROUTER_PREEMPTIVE_CREATE_MATH
static String
ROUTER_START
-
Fields inherited from interface org.apache.solr.cloud.api.collections.RoutedAlias
CREATE_COLLECTION_PREFIX, MINIMAL_REQUIRED_PARAMS, ROUTED_ALIAS_NAME_CORE_PROP, ROUTER_FIELD, ROUTER_TYPE_NAME
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
computeInitialCollectionName()
Create the initial collection for this RoutedAlias if applicable.Instant
computeNextCollTimestamp(Instant fromTimestamp)
Computes the timestamp of the next collection given the timestamp of the one before.String
createCollectionsIfRequired(AddUpdateCommand cmd)
Create any required collections and return the name of the collection to which the current document should be sent.static String
formatCollectionNameFromInstant(String aliasName, Instant timestamp)
Map<String,String>
getAliasMetadata()
String
getAliasName()
The name of the alias.String
getAutoDeleteAgeMath()
String
getIntervalMath()
long
getMaxFutureMs()
Set<String>
getOptionalParams()
String
getPreemptiveCreateWindow()
Set<String>
getRequiredParams()
String
getRouteField()
TimeZone
getTimeZone()
static Instant
parseInstantFromCollectionName(String aliasName, String collection)
String
toString()
boolean
updateParsedCollectionAliases(ZkController zkController)
Ensure our parsed version of the alias collection list is up to date.void
validateRouteValue(AddUpdateCommand cmd)
Check that the value we will be routing on is legal for this type of routed alias.
-
-
-
Field Detail
-
ROUTER_START
public static final String ROUTER_START
- See Also:
- Constant Field Values
-
ROUTER_INTERVAL
public static final String ROUTER_INTERVAL
- See Also:
- Constant Field Values
-
ROUTER_MAX_FUTURE
public static final String ROUTER_MAX_FUTURE
- See Also:
- Constant Field Values
-
ROUTER_AUTO_DELETE_AGE
public static final String ROUTER_AUTO_DELETE_AGE
- See Also:
- Constant Field Values
-
ROUTER_PREEMPTIVE_CREATE_MATH
public static final String ROUTER_PREEMPTIVE_CREATE_MATH
- See Also:
- Constant Field Values
-
REQUIRED_ROUTER_PARAMS
public static final Set<String> REQUIRED_ROUTER_PARAMS
Parameters required for creating a routed alias
-
-
Method Detail
-
computeInitialCollectionName
public String computeInitialCollectionName()
Description copied from interface:RoutedAlias
Create the initial collection for this RoutedAlias if applicable. Routed Aliases do not aggregate existing collections, instead they create collections on the fly. If the initial collection can be determined from initialization parameters it should be calculated here.- Specified by:
computeInitialCollectionName
in interfaceRoutedAlias
- Returns:
- optional string of initial collection name
-
parseInstantFromCollectionName
public static Instant parseInstantFromCollectionName(String aliasName, String collection)
-
formatCollectionNameFromInstant
public static String formatCollectionNameFromInstant(String aliasName, Instant timestamp)
-
updateParsedCollectionAliases
public boolean updateParsedCollectionAliases(ZkController zkController)
Description copied from interface:RoutedAlias
Ensure our parsed version of the alias collection list is up to date. If it was modified, return true. Note that this will return true if some other alias was modified or if properties were modified. These are spurious and the caller should be written to be tolerant of no material changes.- Specified by:
updateParsedCollectionAliases
in interfaceRoutedAlias
-
getAliasName
public String getAliasName()
Description copied from interface:RoutedAlias
The name of the alias. This name is used in place of a collection name for both queries and updates.- Specified by:
getAliasName
in interfaceRoutedAlias
- Returns:
- The name of the Alias.
-
getRouteField
public String getRouteField()
- Specified by:
getRouteField
in interfaceRoutedAlias
-
getIntervalMath
public String getIntervalMath()
-
getMaxFutureMs
public long getMaxFutureMs()
-
getPreemptiveCreateWindow
public String getPreemptiveCreateWindow()
-
getAutoDeleteAgeMath
public String getAutoDeleteAgeMath()
-
getTimeZone
public TimeZone getTimeZone()
-
computeNextCollTimestamp
public Instant computeNextCollTimestamp(Instant fromTimestamp)
Computes the timestamp of the next collection given the timestamp of the one before.
-
validateRouteValue
public void validateRouteValue(AddUpdateCommand cmd) throws SolrException
Description copied from interface:RoutedAlias
Check that the value we will be routing on is legal for this type of routed alias.- Specified by:
validateRouteValue
in interfaceRoutedAlias
- Parameters:
cmd
- the command containing the document- Throws:
SolrException
-
createCollectionsIfRequired
public String createCollectionsIfRequired(AddUpdateCommand cmd)
Description copied from interface:RoutedAlias
Create any required collections and return the name of the collection to which the current document should be sent.- Specified by:
createCollectionsIfRequired
in interfaceRoutedAlias
- Parameters:
cmd
- The command that might cause collection creation- Returns:
- The name of the proper destination collection for the document which may or may not be a newly created collection
-
getAliasMetadata
public Map<String,String> getAliasMetadata()
- Specified by:
getAliasMetadata
in interfaceRoutedAlias
- Returns:
- get alias related metadata
-
getRequiredParams
public Set<String> getRequiredParams()
- Specified by:
getRequiredParams
in interfaceRoutedAlias
-
getOptionalParams
public Set<String> getOptionalParams()
- Specified by:
getOptionalParams
in interfaceRoutedAlias
-
-