Interface IStorageGroupSchemaManager
-
- All Known Implementing Classes:
StorageGroupSchemaManager
public interface IStorageGroupSchemaManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancheckStorageGroupByPath(org.apache.iotdb.commons.path.PartialPath path)Check whether the given path contains a storage groupvoidclear()voiddeleteStorageGroup(org.apache.iotdb.commons.path.PartialPath storageGroup)Delete storage groups of given paths from MTree.IStorageGroupMNodeensureStorageGroupByStorageGroupPath(org.apache.iotdb.commons.path.PartialPath storageGroup)Different with LocalConfigNode.ensureStorageGroup, this method won't init storageGroup resources and the input is the target storage group path.voidforceLog()java.util.List<IStorageGroupMNode>getAllStorageGroupNodes()Get all storage group MNodesjava.util.List<org.apache.iotdb.commons.path.PartialPath>getAllStorageGroupPaths()Get all storage group pathsorg.apache.iotdb.commons.path.PartialPathgetBelongedStorageGroup(org.apache.iotdb.commons.path.PartialPath path)Get storage group name by pathjava.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>getInvolvedStorageGroups(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 matching given path pattern.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)To collect nodes in the given level for given path pattern.IStorageGroupMNodegetStorageGroupNodeByPath(org.apache.iotdb.commons.path.PartialPath path)Get storage group node by path.intgetStorageGroupNum(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch)To calculate the count of storage group for given path pattern.java.util.Map<java.lang.String,java.util.List<org.apache.iotdb.commons.path.PartialPath>>groupPathByStorageGroup(org.apache.iotdb.commons.path.PartialPath path)For a path, infer all storage groups it may belong to.voidinit()booleanisStorageGroup(org.apache.iotdb.commons.path.PartialPath path)Check if the given path is storage group or not.booleanisStorageGroupAlreadySet(org.apache.iotdb.commons.path.PartialPath path)Check whether the storage group of given path is set.voidsetStorageGroup(org.apache.iotdb.commons.path.PartialPath path)Set storage group of the given path to MTree.voidsetTTL(org.apache.iotdb.commons.path.PartialPath storageGroup, long dataTTL)
-
-
-
Method Detail
-
init
void init() throws org.apache.iotdb.commons.exception.MetadataException, java.io.IOException- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.io.IOException
-
forceLog
void forceLog()
-
clear
void clear() throws java.io.IOException- Throws:
java.io.IOException
-
setStorageGroup
void setStorageGroup(org.apache.iotdb.commons.path.PartialPath path) throws org.apache.iotdb.commons.exception.MetadataExceptionSet storage group of the given path to MTree.- Parameters:
path- storage group path- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
deleteStorageGroup
void deleteStorageGroup(org.apache.iotdb.commons.path.PartialPath storageGroup) throws org.apache.iotdb.commons.exception.MetadataExceptionDelete storage groups of given paths from MTree. Log format: "delete_storage_group,sg1,sg2,sg3"- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
setTTL
void setTTL(org.apache.iotdb.commons.path.PartialPath storageGroup, long dataTTL) throws org.apache.iotdb.commons.exception.MetadataException, java.io.IOException- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.io.IOException
-
isStorageGroup
boolean isStorageGroup(org.apache.iotdb.commons.path.PartialPath path)
Check if the given path is storage group or not.
-
checkStorageGroupByPath
boolean checkStorageGroupByPath(org.apache.iotdb.commons.path.PartialPath path)
Check whether the given path contains a storage group
-
getBelongedStorageGroup
org.apache.iotdb.commons.path.PartialPath getBelongedStorageGroup(org.apache.iotdb.commons.path.PartialPath path) throws StorageGroupNotSetExceptionGet storage group name by pathe.g., root.sg1 is a storage group and path = root.sg1.d1, return root.sg1
- Parameters:
path- only full path, cannot be path pattern- Returns:
- storage group in the given path
- Throws:
StorageGroupNotSetException
-
getBelongedStorageGroups
java.util.List<org.apache.iotdb.commons.path.PartialPath> getBelongedStorageGroups(org.apache.iotdb.commons.path.PartialPath pathPattern) throws org.apache.iotdb.commons.exception.MetadataExceptionGet 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 pattern
- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getInvolvedStorageGroups
java.util.List<org.apache.iotdb.commons.path.PartialPath> getInvolvedStorageGroups(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch) throws org.apache.iotdb.commons.exception.MetadataException- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getMatchedStorageGroups
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.MetadataExceptionGet all storage group matching given path pattern. 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 pattern of a full pathisPrefixMatch- if true, the path pattern is used to match prefix path- Returns:
- A ArrayList instance which stores storage group paths matching given path pattern.
- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getAllStorageGroupPaths
java.util.List<org.apache.iotdb.commons.path.PartialPath> getAllStorageGroupPaths()
Get all storage group paths
-
groupPathByStorageGroup
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.MetadataExceptionFor a path, infer all storage groups it may belong to. The path can have wildcards. Resolve the path or path pattern into StorageGroupName-FullPath pairs that FullPath matches the given path.Consider the path into two parts: (1) the sub path which can not contain a storage group name and (2) the sub path which is substring that begin after the storage group name.
(1) Suppose the part of the path can not contain a storage group name (e.g., "root".contains("root.sg") == false), then: For each one level wildcard *, only one level will be inferred and the wildcard will be removed. For each multi level wildcard **, then the inference will go on until the storage groups are found and the wildcard will be kept. (2) Suppose the part of the path is a substring that begin after the storage group name. (e.g., For "root.*.sg1.a.*.b.*" and "root.x.sg1" is a storage group, then this part is "a.*.b.*"). For this part, keep what it is.
Assuming we have three SGs: root.group1, root.group2, root.area1.group3 Eg1: for input "root.**", returns ("root.group1", "root.group1.**"), ("root.group2", "root.group2.**") ("root.area1.group3", "root.area1.group3.**") Eg2: for input "root.*.s1", returns ("root.group1", "root.group1.s1"), ("root.group2", "root.group2.s1")
Eg3: for input "root.area1.**", returns ("root.area1.group3", "root.area1.group3.**")
- Parameters:
path- can be a path pattern or a full path.- Returns:
- StorageGroupName-FullPath pairs
- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getStorageGroupNum
int getStorageGroupNum(org.apache.iotdb.commons.path.PartialPath pathPattern, boolean isPrefixMatch) throws org.apache.iotdb.commons.exception.MetadataExceptionTo calculate the count of storage group for given path pattern. If using prefix match, the path pattern is used to match prefix path. All timeseries start with the matched prefix path will be counted.- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getStorageGroupNodeByPath
IStorageGroupMNode getStorageGroupNodeByPath(org.apache.iotdb.commons.path.PartialPath path) throws org.apache.iotdb.commons.exception.MetadataException
Get storage group node by path. the give path don't need to be storage group path.- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getAllStorageGroupNodes
java.util.List<IStorageGroupMNode> getAllStorageGroupNodes()
Get all storage group MNodes
-
ensureStorageGroupByStorageGroupPath
IStorageGroupMNode ensureStorageGroupByStorageGroupPath(org.apache.iotdb.commons.path.PartialPath storageGroup) throws org.apache.iotdb.commons.exception.MetadataException
Different with LocalConfigNode.ensureStorageGroup, this method won't init storageGroup resources and the input is the target storage group path.- Parameters:
storageGroup- storage group path- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
isStorageGroupAlreadySet
boolean isStorageGroupAlreadySet(org.apache.iotdb.commons.path.PartialPath path)
Check whether the storage group of given path is set. The path may be a prefix path of some storage group. Besides, the given path may be also beyond the MTreeAboveSG scope, then return true if the covered part exists, which means there's storage group on this path. The rest part will be checked by certain storage group subTree.- Parameters:
path- a full path or a prefix path
-
getNodesListInGivenLevel
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.MetadataExceptionTo collect nodes in the given level for given path pattern. If using prefix match, the path pattern is used to match prefix path. All nodes start with the matched prefix path will be collected. This method only count in nodes above storage group. Nodes below storage group, including storage group node will be collected by certain SchemaRegion. The involved storage groups will be collected to fetch schemaRegion.- Parameters:
pathPattern- a path pattern or a full pathnodeLevel- the level should match the level of the pathisPrefixMatch- if true, the path pattern is used to match prefix path- Throws:
org.apache.iotdb.commons.exception.MetadataException
-
getChildNodePathInNextLevel
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.MetadataExceptionGet 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 Storage Group.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
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.MetadataExceptionGet 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 Storage Group.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
-
-