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) |
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) |
byte[] |
toJSON()
Serialize our state.
|
String |
toString() |
public static final Aliases EMPTY
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 IllegalArgumentException
aliasName
- alias nameIllegalArgumentException
- if either direct or indirect alias points to more than 1 name.public static String resolveSimpleAliasGivenAliasMap(Map<String,List<String>> collectionAliasListMap, String aliasName) throws IllegalArgumentException
IllegalArgumentException
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)
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.IllegalArgumentException
- 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)
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.Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.