public class Aliases extends Object
Modifier and Type | Field and Description |
---|---|
static Aliases |
EMPTY
An empty, minimal Aliases primarily used to support the non-cloud solr use cases.
|
Modifier and Type | Method and Description |
---|---|
Aliases |
cloneWithCollectionAlias(String alias,
String collections)
Creates a new Aliases instance with the same data as the current one but with a modification based on the
parameters.
|
Aliases |
cloneWithCollectionAliasProperties(String alias,
Map<String,String> properties)
Set the values for some properties keys on a collection alias.
|
Aliases |
cloneWithCollectionAliasProperties(String alias,
String propertiesKey,
String propertiesValue)
Set the value for some properties on a collection alias.
|
Aliases |
cloneWithRename(String before,
String after)
Rename an alias.
|
static Map<String,List<String>> |
convertMapOfCommaDelimitedToMapOfList(Map<String,String> collectionAliasMap) |
static Map<String,String> |
convertMapOfListToMapOfCommaDelimited(Map<String,List<String>> collectionAliasMap) |
void |
forEachAlias(BiConsumer<String,List<String>> consumer) |
static Aliases |
fromJSON(byte[] bytes,
int zNodeVersion)
Create an instance from the JSON bytes read from zookeeper.
|
Map<String,List<String>> |
getCollectionAliasListMap()
Get a fully parsed map of collection aliases.
|
Map<String,String> |
getCollectionAliasMap()
Get a map similar to the JSON data as stored in zookeeper.
|
Map<String,String> |
getCollectionAliasProperties(String alias)
Returns an unmodifiable Map of properties for a given alias.
|
int |
getZNodeVersion() |
boolean |
hasAlias(String aliasName)
Returns true if an alias is defined, false otherwise.
|
boolean |
isRoutedAlias(String aliasName)
Returns true if an alias exists and is a routed alias, false otherwise.
|
List<String> |
resolveAliases(String aliasName)
List the collections associated with a particular alias.
|
static List<String> |
resolveAliasesGivenAliasMap(Map<String,List<String>> collectionAliasListMap,
String aliasName) |
String |
resolveSimpleAlias(String aliasName)
Resolve an alias that points to a single collection.
|
static String |
resolveSimpleAliasGivenAliasMap(Map<String,List<String>> collectionAliasListMap,
String aliasName) |
int |
size() |
byte[] |
toJSON()
Serialize our state.
|
String |
toString() |
public static final Aliases EMPTY
public void forEachAlias(BiConsumer<String,List<String>> consumer)
public int size()
public static Aliases fromJSON(byte[] bytes, int zNodeVersion)
bytes
- The bytes read via a getData request to zookeeper (possibly null)zNodeVersion
- the version of the data in zookeeper that this instance corresponds topublic byte[] toJSON()
public static Map<String,List<String>> convertMapOfCommaDelimitedToMapOfList(Map<String,String> collectionAliasMap)
public static Map<String,String> convertMapOfListToMapOfCommaDelimited(Map<String,List<String>> collectionAliasMap)
public int getZNodeVersion()
public Map<String,String> getCollectionAliasMap()
getCollectionAliasListMap()
instead, if collection names will be iterated.public Map<String,List<String>> getCollectionAliasListMap()
public Map<String,String> getCollectionAliasProperties(String alias)
alias
- the name of an alias also found as a key in getCollectionAliasListMap()
public List<String> resolveAliases(String aliasName)
public boolean hasAlias(String aliasName)
public boolean isRoutedAlias(String aliasName)
public String resolveSimpleAlias(String aliasName) throws SolrException
aliasName
- alias nameSolrException
- if either direct or indirect alias points to more than 1 name.public static String resolveSimpleAliasGivenAliasMap(Map<String,List<String>> collectionAliasListMap, String aliasName) throws SolrException
SolrException
public static List<String> resolveAliasesGivenAliasMap(Map<String,List<String>> collectionAliasListMap, String aliasName)
public Aliases cloneWithCollectionAlias(String alias, String collections)
Note that the state in zookeeper is unaffected by this method and the change must still be persisted via
ZkStateReader.AliasesManager.applyModificationAndExportToZk(UnaryOperator)
alias
- the alias to update, must not be nullcollections
- the comma separated list of collections for the alias, null to remove the aliaspublic Aliases cloneWithRename(String before, String after) throws SolrException
Note that the state in zookeeper is unaffected by this method and the change must still be persisted via
ZkStateReader.AliasesManager.applyModificationAndExportToZk(UnaryOperator)
before
- previous alias name, must not be nullafter
- new alias name. If this is null then it's equivalent to calling cloneWithCollectionAlias(String, String)
with the second argument set to null, ie. removing an alias.SolrException
- when either before
or after
is empty, or
the before
name is a routed aliaspublic Aliases cloneWithCollectionAliasProperties(String alias, String propertiesKey, String propertiesValue)
Note that the state in zookeeper is unaffected by this method and the change must still be persisted via
ZkStateReader.AliasesManager.applyModificationAndExportToZk(UnaryOperator)
alias
- the alias to updatepropertiesKey
- the key for the propertiespropertiesValue
- the properties to add/replace, null to remove the key.public Aliases cloneWithCollectionAliasProperties(String alias, Map<String,String> properties) throws SolrException
Note that the state in zookeeper is unaffected by this method and the change must still be persisted via
ZkStateReader.AliasesManager.applyModificationAndExportToZk(UnaryOperator)
alias
- the alias to updateproperties
- the properties to add/replace, null values in the map will remove the key.SolrException
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.