类 ShenyuTrie

java.lang.Object
org.apache.shenyu.plugin.base.trie.ShenyuTrie

public class ShenyuTrie extends Object
  • 构造器概要

    构造器
    构造器
    说明
    ShenyuTrie(Long cacheSize, String matchMode)
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    clear the trie.
    get key root map key set.
    getNode(String uriPath, String bizInfo)
    getNode.
    boolean
    judge the trie is empty.
    match(String uriPath, String bizInfo)
    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> void
    putNode(String uriPath, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType)
    put node to trie, shenyu trie support *, **, path, pathVariable parameters.
    <T> void
    putNode(List<String> uriPaths, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType)
    put node to trie.
    <T> void
    remove(String path, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType)
    remove trie node.
    <T> void
    remove(List<String> paths, T source, org.apache.shenyu.common.enums.TrieCacheTypeEnum cacheType)
    remove trie node.
    void
    remove trie cache by key.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • ShenyuTrie

      public ShenyuTrie(Long cacheSize, String matchMode)
  • 方法详细资料

    • 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 path
      source - data
      cacheType - 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 path
      source - rule data or selector data
      cacheType - cache type
      另请参阅:
      • AntPathMatcher
      • PathPattern
    • match

      public ShenyuTrieNode match(String uriPath, String bizInfo)
      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 path
      bizInfo - 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 list
      source - source data
      cacheType - 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 - path
      source - source data
      cacheType - cache type
    • removeByKey

      public void removeByKey(String key)
      remove trie cache by key.
      参数:
      key - key
    • getNode

      public ShenyuTrieNode getNode(String uriPath, String bizInfo)
      getNode.
      参数:
      uriPath - uriPath
      bizInfo - source
      返回:
      ShenyuTrieNode
    • getKeyRootKeys

      public Set<String> getKeyRootKeys()
      get key root map key set.
      返回:
      key set