java.lang.Object
org.apache.iotdb.confignode.persistence.schema.ConfigMTree

public class ConfigMTree extends Object
  • Constructor Details

  • Method Details

    • clear

      public void clear()
    • setStorageGroup

      public void setStorageGroup(PartialPath path) throws MetadataException
      CREATE DATABASE. Make sure check seriesPath before setting database
      Parameters:
      path - path
      Throws:
      MetadataException
    • deleteDatabase

      public void deleteDatabase(PartialPath path) throws MetadataException
      Delete a database
      Throws:
      MetadataException
    • getBelongedDatabases

      public List<PartialPath> getBelongedDatabases(PartialPath pathPattern) throws MetadataException
      Get the database that given path pattern matches or belongs to.

      Suppose we have (root.sg1.d1.s1, root.sg2.d2.s2), refer the following cases: 1. given path "root.sg1", ("root.sg1") will be returned. 2. given path "root.*", ("root.sg1", "root.sg2") will be returned. 3. given path "root.*.d1.s1", ("root.sg1", "root.sg2") will be returned.

      Parameters:
      pathPattern - a path pattern or a full path
      Returns:
      a list contains all databases related to given path
      Throws:
      MetadataException
    • getMatchedDatabases

      public List<PartialPath> getMatchedDatabases(PartialPath pathPattern, PathPatternTree scope, boolean isPrefixMatch) throws MetadataException
      Get all database that the given path pattern matches. If using prefix match, the path pattern is used to match prefix path. All timeseries start with the matched prefix path will be collected.
      Parameters:
      pathPattern - a path pattern or a full path
      scope - traversing scope
      isPrefixMatch - if true, the path pattern is used to match prefix path
      Returns:
      a list contains all database names under given path pattern
      Throws:
      MetadataException
    • getAllDatabasePaths

      public List<PartialPath> getAllDatabasePaths()
      Get all database names
      Returns:
      a list contains all distinct databases
    • getDatabaseNum

      public int getDatabaseNum(PartialPath pathPattern, PathPatternTree scope, boolean isPrefixMatch) throws MetadataException
      Get the count of database matching the given path. If using prefix match, the path pattern is used to match prefix path. All timeseries start with the matched prefix path will be counted.
      Parameters:
      pathPattern - a path pattern or a full path, may contain wildcard.
      scope - traversing scope
      isPrefixMatch - if true, the path pattern is used to match prefix path
      Throws:
      MetadataException
    • getDatabaseNodeByDatabasePath

      public IDatabaseMNode<IConfigMNode> getDatabaseNodeByDatabasePath(PartialPath databasePath) throws MetadataException
      E.g., root.sg is database given [root, sg], if the give path is not a database, throw exception
      Throws:
      MetadataException
    • getDatabaseNodeByPath

      public IDatabaseMNode<IConfigMNode> getDatabaseNodeByPath(PartialPath path) throws MetadataException
      E.g., root.sg is database given [root, sg], return the MNode of root.sg given [root, sg, device], return the MNode of root.sg Get database node, the give path don't need to be database path.
      Throws:
      MetadataException
    • isDatabaseAlreadySet

      public boolean isDatabaseAlreadySet(PartialPath path)
      Check whether the database of given path exists. The given path may be a prefix path of existing database.
      Parameters:
      path - a full path or a prefix path
    • checkDatabaseAlreadySet

      public void checkDatabaseAlreadySet(PartialPath path) throws DatabaseAlreadySetException
      Check whether the database of given path exists. The given path may be a prefix path of existing database. if exists will throw MetaException.
      Parameters:
      path - a full path or a prefix path
      Throws:
      DatabaseAlreadySetException
    • getNodeWithAutoCreate

      public IConfigMNode getNodeWithAutoCreate(PartialPath path) throws DatabaseNotSetException
      Throws:
      DatabaseNotSetException
    • getNodesListInGivenLevel

      public org.apache.tsfile.utils.Pair<List<PartialPath>,Set<PartialPath>> getNodesListInGivenLevel(PartialPath pathPattern, int nodeLevel, boolean isPrefixMatch, PathPatternTree scope) throws MetadataException
      Get all paths of nodes in the given level matching the given path. If using prefix match, the path pattern is used to match prefix path.
      Throws:
      MetadataException
    • getChildNodePathInNextLevel

      public org.apache.tsfile.utils.Pair<Set<TSchemaNode>,Set<PartialPath>> getChildNodePathInNextLevel(PartialPath pathPattern, PathPatternTree scope) throws MetadataException
      Get child node path in the next level of the given path pattern. This method only count in nodes above database. Nodes below database, including database node will be counted by certain MTreeBelowSG.

      give pathPattern and the child nodes is those matching pathPattern.*

      e.g., MTree has [root.a.sg1.d1.s1, root.b.sg1.d1.s2, root.c.sg1.d2.s1] given path = root return [root.a, root.b]

      Parameters:
      pathPattern - The given path
      scope - traversing scope
      Returns:
      All child nodes' seriesPath(s) of given seriesPath.
      Throws:
      MetadataException
    • checkTemplateOnPath

      public void checkTemplateOnPath(PartialPath path) throws MetadataException
      check whether there is template on given path and the subTree has template return true, otherwise false
      Throws:
      MetadataException
    • getPathsSetOnTemplate

      public List<String> getPathsSetOnTemplate(int templateId, PathPatternTree scope, boolean filterPreUnset) throws MetadataException
      Throws:
      MetadataException
    • getTemplateSetInfo

      public Map<Integer,Set<PartialPath>> getTemplateSetInfo(PartialPath pathPattern) throws MetadataException
      This method returns the templateId set on paths covered by input path pattern.
      Throws:
      MetadataException
    • setTemplate

      public void setTemplate(int templateId, PartialPath templateSetPath) throws MetadataException
      Throws:
      MetadataException
    • preUnsetTemplate

      public void preUnsetTemplate(int templateId, PartialPath path) throws MetadataException
      Throws:
      MetadataException
    • rollbackUnsetTemplate

      public void rollbackUnsetTemplate(int templateId, PartialPath path) throws MetadataException
      Throws:
      MetadataException
    • unsetTemplate

      public void unsetTemplate(int templateId, PartialPath path) throws MetadataException
      Throws:
      MetadataException
    • serialize

      public void serialize(OutputStream outputStream) throws IOException
      Throws:
      IOException
    • deserialize

      public void deserialize(InputStream inputStream) throws IOException
      Throws:
      IOException