类 ShenyuTrie
java.lang.Object
org.apache.shenyu.plugin.base.trie.ShenyuTrie
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclear()clear the trie.get key root map key set.getNode.booleanisEmpty()judge the trie is empty.match trie, trie exist and match the path will return current node
match strategy: plugin get the node from trie and mark conflict, match sort: path, wildcard, match-all, path variable.<T> voidput node to trie, shenyu trie support *, **, path, pathVariable parameters.<T> voidputNode(List<String> uriPaths, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType) put node to trie.<T> voidremove trie node.<T> voidremove trie node.voidremoveByKey(String key) remove trie cache by key.
-
构造器详细资料
-
ShenyuTrie
-
-
方法详细资料
-
clear
public void clear()clear the trie. -
isEmpty
public boolean isEmpty()judge the trie is empty.- 返回:
- status
-
putNode
public <T> void putNode(List<String> uriPaths, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType) put node to trie.- 类型参数:
T- the data type- 参数:
uriPaths- uri pathsource- datacacheType- cache type
-
putNode
public <T> void putNode(String uriPath, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType) put node to trie, shenyu trie support *, **, path, pathVariable parameters.
* means match 0 or more character
** means match 0 or more dictory directory
pathVariable maybe like {name}
- 类型参数:
T- biz info type- 参数:
uriPath- uri pathsource- rule data or selector datacacheType- cache type- 另请参阅:
-
AntPathMatcherPathPattern
-
match
match trie, trie exist and match the path will return current node
match strategy: plugin get the node from trie and mark conflict, match sort: path, wildcard, match-all, path variable. generally, wildcard, match-all, path-variable have the same matching rights as path, if there are the above path matching variables in the child nodes of the current node, multi-marking will be performed.
how to mark conflict: if current node has many conflict node, match mark number increment.
match conflict: if current node has conflict node, mark the conflict with array index, traverse over trie, if plugin can't get node from trie, check conflict, and resolve conflict, if plugin has resolve conflict but can't get node from trie, return null.- 参数:
uriPath- uri pathbizInfo- bizInfo- 返回:
- ShenyuTrieNode
-
remove
public <T> void remove(List<String> paths, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType) remove trie node.- 类型参数:
T- selector data or rule data- 参数:
paths- path listsource- source datacacheType- cache type
-
remove
public <T> void remove(String path, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType) remove trie node.query node of the current path, if the node exists and the node exist the value of pathCache, delete a rule with the same ruleId from pathCache or delete a selector by pluginName.
if current source data list is empty, children and pathVariablesSet is null,remove concurrent node from parent node.
- 类型参数:
T- selector data or rule data- 参数:
path- pathsource- source datacacheType- cache type
-
removeByKey
remove trie cache by key.- 参数:
key- key
-
getNode
getNode.- 参数:
uriPath- uriPathbizInfo- source- 返回:
ShenyuTrieNode
-
getKeyRootKeys
get key root map key set.- 返回:
- key set
-