Class ConfigMTree
java.lang.Object
org.apache.iotdb.confignode.persistence.schema.ConfigMTree
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck whether the database of given path exists.voidcheck whether there is template on given path and the subTree has template return true, otherwise falsevoidclear()voiddeleteDatabase(PartialPath path) Delete a databasevoiddeserialize(InputStream inputStream) Get all database namesgetBelongedDatabases(PartialPath pathPattern) Get the database that given path pattern matches or belongs to.org.apache.tsfile.utils.Pair<Set<TSchemaNode>,Set<PartialPath>> getChildNodePathInNextLevel(PartialPath pathPattern, PathPatternTree scope) Get child node path in the next level of the given path pattern.getDatabaseNodeByDatabasePath(PartialPath databasePath) E.g., root.sg is database given [root, sg], if the give path is not a database, throw exceptionE.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.intgetDatabaseNum(PartialPath pathPattern, PathPatternTree scope, boolean isPrefixMatch) Get the count of database matching the given path.getMatchedDatabases(PartialPath pathPattern, PathPatternTree scope, boolean isPrefixMatch) Get all database that the given path pattern matches.org.apache.tsfile.utils.Pair<List<PartialPath>,Set<PartialPath>> getNodesListInGivenLevel(PartialPath pathPattern, int nodeLevel, boolean isPrefixMatch, PathPatternTree scope) Get all paths of nodes in the given level matching the given path.getPathsSetOnTemplate(int templateId, PathPatternTree scope, boolean filterPreUnset) getTemplateSetInfo(PartialPath pathPattern) This method returns the templateId set on paths covered by input path pattern.booleanCheck whether the database of given path exists.voidpreUnsetTemplate(int templateId, PartialPath path) voidrollbackUnsetTemplate(int templateId, PartialPath path) voidserialize(OutputStream outputStream) voidsetStorageGroup(PartialPath path) CREATE DATABASE.voidsetTemplate(int templateId, PartialPath templateSetPath) voidunsetTemplate(int templateId, PartialPath path)
-
Constructor Details
-
ConfigMTree
- Throws:
MetadataException
-
-
Method Details
-
clear
public void clear() -
setStorageGroup
CREATE DATABASE. Make sure check seriesPath before setting database- Parameters:
path- path- Throws:
MetadataException
-
deleteDatabase
Delete a database- Throws:
MetadataException
-
getBelongedDatabases
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 pathscope- traversing scopeisPrefixMatch- 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
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 scopeisPrefixMatch- 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
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
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
- 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 pathscope- traversing scope- Returns:
- All child nodes' seriesPath(s) of given seriesPath.
- Throws:
MetadataException
-
checkTemplateOnPath
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
- Throws:
MetadataException
-
preUnsetTemplate
- Throws:
MetadataException
-
rollbackUnsetTemplate
- Throws:
MetadataException
-
unsetTemplate
- Throws:
MetadataException
-
serialize
- Throws:
IOException
-
deserialize
- Throws:
IOException
-