Class ConfigMTree


  • public class ConfigMTree
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigMTree()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkStorageGroupAlreadySet​(org.apache.iotdb.commons.path.PartialPath path)
      Check whether the storage group of given path exists.
      boolean checkStorageGroupByPath​(org.apache.iotdb.commons.path.PartialPath path)
      Check whether the given path contains a storage group
      void checkTemplateOnPath​(org.apache.iotdb.commons.path.PartialPath path)
      check whether there is template on given path and the subTree has template return true, otherwise false
      void clear()  
      void deleteStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
      Delete a storage group
      void deserialize​(java.io.InputStream inputStream)  
      java.util.List<IStorageGroupMNode> getAllStorageGroupNodes()
      Get all storage group MNodes
      java.util.List<org.apache.iotdb.commons.path.PartialPath> getAllStorageGroupPaths()
      Get all storage group names
      org.apache.iotdb.commons.path.PartialPath getBelongedStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
      Get storage group path by path
      java.util.List<org.apache.iotdb.commons.path.PartialPath> getBelongedStorageGroups​(org.apache.iotdb.commons.path.PartialPath pathPattern)
      Get the storage group that given path pattern matches or belongs to.
      org.apache.iotdb.tsfile.utils.Pair<java.util.Set<java.lang.String>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getChildNodeNameInNextLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern)
      Get child node path in the next level of the given path pattern.
      org.apache.iotdb.tsfile.utils.Pair<java.util.Set<org.apache.iotdb.common.rpc.thrift.TSchemaNode>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getChildNodePathInNextLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern)
      Get child node path in the next level of the given path pattern.
      java.util.List<org.apache.iotdb.commons.path.PartialPath> getInvolvedStorageGroupNodes​(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch)  
      java.util.List<org.apache.iotdb.commons.path.PartialPath> getMatchedStorageGroups​(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch)
      Get all storage group that the given path pattern matches.
      org.apache.iotdb.tsfile.utils.Pair<java.util.List<org.apache.iotdb.commons.path.PartialPath>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getNodesListInGivenLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern, int nodeLevel, boolean isPrefixMatch, LocalSchemaProcessor.StorageGroupFilter filter)
      Get all paths of nodes in the given level matching the given path.
      IMNode getNodeWithAutoCreate​(org.apache.iotdb.commons.path.PartialPath path)  
      java.util.List<java.lang.String> getPathsSetOnTemplate​(int templateId)  
      IStorageGroupMNode getStorageGroupNodeByPath​(org.apache.iotdb.commons.path.PartialPath path)
      E.g., root.sg is storage group given [root, sg], return the MNode of root.sg given [root, sg, device], return the MNode of root.sg Get storage group node, the give path don't need to be storage group path.
      IStorageGroupMNode getStorageGroupNodeByStorageGroupPath​(org.apache.iotdb.commons.path.PartialPath storageGroupPath)
      E.g., root.sg is storage group given [root, sg], if the give path is not a storage group, throw exception
      int getStorageGroupNum​(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch)
      Get the count of storage group matching the given path.
      java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.commons.path.PartialPath>> groupPathByStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
      Resolve the path or path pattern into StorageGroupName-FullPath pairs.
      boolean isStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
      Check whether path is storage group or not
      boolean isStorageGroupAlreadySet​(org.apache.iotdb.commons.path.PartialPath path)
      Check whether the storage group of given path exists.
      void serialize​(java.io.OutputStream outputStream)  
      void setStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
      Set storage group.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigMTree

        public ConfigMTree()
                    throws org.apache.iotdb.commons.exception.MetadataException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
    • Method Detail

      • clear

        public void clear()
      • setStorageGroup

        public void setStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
                             throws org.apache.iotdb.commons.exception.MetadataException
        Set storage group. Make sure check seriesPath before setting storage group
        Parameters:
        path - path
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • deleteStorageGroup

        public void deleteStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
                                throws org.apache.iotdb.commons.exception.MetadataException
        Delete a storage group
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • isStorageGroup

        public boolean isStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
        Check whether path is storage group or not

        e.g., path = root.a.b.sg. if nor a and b is StorageGroupMNode and sg is a StorageGroupMNode path is a storage group

        Parameters:
        path - path
      • checkStorageGroupByPath

        public boolean checkStorageGroupByPath​(org.apache.iotdb.commons.path.PartialPath path)
        Check whether the given path contains a storage group
      • getBelongedStorageGroup

        public org.apache.iotdb.commons.path.PartialPath getBelongedStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
                                                                          throws StorageGroupNotSetException
        Get storage group path by path

        e.g., root.sg1 is storage group, path is root.sg1.d1, return root.sg1

        Returns:
        storage group in the given path
        Throws:
        StorageGroupNotSetException
      • getBelongedStorageGroups

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getBelongedStorageGroups​(org.apache.iotdb.commons.path.PartialPath pathPattern)
                                                                                           throws org.apache.iotdb.commons.exception.MetadataException
        Get the storage group 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 storage groups related to given path
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getMatchedStorageGroups

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getMatchedStorageGroups​(org.apache.iotdb.commons.path.PartialPath pathPattern,
                                                                                                 boolean isPrefixMatch)
                                                                                          throws org.apache.iotdb.commons.exception.MetadataException
        Get all storage group 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
        isPrefixMatch - if true, the path pattern is used to match prefix path
        Returns:
        a list contains all storage group names under given path pattern
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getAllStorageGroupPaths

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getAllStorageGroupPaths()
        Get all storage group names
        Returns:
        a list contains all distinct storage groups
      • groupPathByStorageGroup

        public java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.commons.path.PartialPath>> groupPathByStorageGroup​(org.apache.iotdb.commons.path.PartialPath path)
                                                                                                                                throws org.apache.iotdb.commons.exception.MetadataException
        Resolve the path or path pattern into StorageGroupName-FullPath pairs. Try determining the storage group using the children of a mNode. If one child is a storage group node, put a storageGroupName-fullPath pair into paths.
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getStorageGroupNum

        public int getStorageGroupNum​(org.apache.iotdb.commons.path.PartialPath pathPattern,
                                      boolean isPrefixMatch)
                               throws org.apache.iotdb.commons.exception.MetadataException
        Get the count of storage group 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.
        isPrefixMatch - if true, the path pattern is used to match prefix path
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getStorageGroupNodeByStorageGroupPath

        public IStorageGroupMNode getStorageGroupNodeByStorageGroupPath​(org.apache.iotdb.commons.path.PartialPath storageGroupPath)
                                                                 throws org.apache.iotdb.commons.exception.MetadataException
        E.g., root.sg is storage group given [root, sg], if the give path is not a storage group, throw exception
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getStorageGroupNodeByPath

        public IStorageGroupMNode getStorageGroupNodeByPath​(org.apache.iotdb.commons.path.PartialPath path)
                                                     throws org.apache.iotdb.commons.exception.MetadataException
        E.g., root.sg is storage group given [root, sg], return the MNode of root.sg given [root, sg, device], return the MNode of root.sg Get storage group node, the give path don't need to be storage group path.
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getInvolvedStorageGroupNodes

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getInvolvedStorageGroupNodes​(org.apache.iotdb.commons.path.PartialPath pathPattern,
                                                                                                      boolean isPrefixMatch)
                                                                                               throws org.apache.iotdb.commons.exception.MetadataException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getAllStorageGroupNodes

        public java.util.List<IStorageGroupMNode> getAllStorageGroupNodes()
        Get all storage group MNodes
      • isStorageGroupAlreadySet

        public boolean isStorageGroupAlreadySet​(org.apache.iotdb.commons.path.PartialPath path)
        Check whether the storage group of given path exists. The given path may be a prefix path of existing storage group.
        Parameters:
        path - a full path or a prefix path
      • checkStorageGroupAlreadySet

        public void checkStorageGroupAlreadySet​(org.apache.iotdb.commons.path.PartialPath path)
                                         throws StorageGroupAlreadySetException
        Check whether the storage group of given path exists. The given path may be a prefix path of existing storage group. if exists will throw MetaException.
        Parameters:
        path - a full path or a prefix path
        Throws:
        StorageGroupAlreadySetException
      • getNodesListInGivenLevel

        public org.apache.iotdb.tsfile.utils.Pair<java.util.List<org.apache.iotdb.commons.path.PartialPath>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getNodesListInGivenLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern,
                                                                                                                                                                                                     int nodeLevel,
                                                                                                                                                                                                     boolean isPrefixMatch,
                                                                                                                                                                                                     LocalSchemaProcessor.StorageGroupFilter filter)
                                                                                                                                                                                              throws org.apache.iotdb.commons.exception.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:
        org.apache.iotdb.commons.exception.MetadataException
      • getChildNodePathInNextLevel

        public org.apache.iotdb.tsfile.utils.Pair<java.util.Set<org.apache.iotdb.common.rpc.thrift.TSchemaNode>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getChildNodePathInNextLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern)
                                                                                                                                                                                                     throws org.apache.iotdb.commons.exception.MetadataException
        Get child node path in the next level of the given path pattern. This method only count in nodes above storage group. Nodes below storage group, including storage group 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
        Returns:
        All child nodes' seriesPath(s) of given seriesPath.
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • getChildNodeNameInNextLevel

        public org.apache.iotdb.tsfile.utils.Pair<java.util.Set<java.lang.String>,​java.util.Set<org.apache.iotdb.commons.path.PartialPath>> getChildNodeNameInNextLevel​(org.apache.iotdb.commons.path.PartialPath pathPattern)
                                                                                                                                                                       throws org.apache.iotdb.commons.exception.MetadataException
        Get child node path in the next level of the given path pattern. This method only count in nodes above storage group. Nodes below storage group, including storage group 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 [a, b]

        Parameters:
        pathPattern - The given path
        Returns:
        All child nodes' seriesPath(s) of given seriesPath.
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • checkTemplateOnPath

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

        public java.util.List<java.lang.String> getPathsSetOnTemplate​(int templateId)
                                                               throws org.apache.iotdb.commons.exception.MetadataException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • serialize

        public void serialize​(java.io.OutputStream outputStream)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • deserialize

        public void deserialize​(java.io.InputStream inputStream)
                         throws java.io.IOException
        Throws:
        java.io.IOException