Class InternalMNode
- java.lang.Object
-
- org.apache.iotdb.db.metadata.mnode.MNode
-
- org.apache.iotdb.db.metadata.mnode.InternalMNode
-
- All Implemented Interfaces:
java.io.Serializable,IMNode
- Direct Known Subclasses:
EntityMNode,StorageGroupMNode
public class InternalMNode extends MNode
This class is the implementation of Metadata Node. One MNode instance represents one node in the Metadata Tree- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected IMNodeContainerchildrenuse in Measurement Node so it's protected suppress warnings reason: volatile for double synchronized checkprotected TemplateschemaTemplateprotected intschemaTemplateId-
Fields inherited from class org.apache.iotdb.db.metadata.mnode.MNode
cacheEntry, fullPath, name, parent, triggerExecutor
-
-
Constructor Summary
Constructors Constructor Description InternalMNode(IMNode parent, java.lang.String name)Constructor of MNode.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,C>
Raccept(MNodeVisitor<R,C> visitor, C context)IMNodeaddChild(java.lang.String name, IMNode child)add a child to current mnodeIMNodeaddChild(IMNode child)Add a child to the current mnode.IMNodedeleteChild(java.lang.String name)delete a childstatic InternalMNodedeserializeFrom(MNodePlan plan)IMNodegetChild(java.lang.String name)get the child with the nameIMNodeContainergetChildren()MNodeTypegetMNodeType(java.lang.Boolean isConfig)TemplategetSchemaTemplate()intgetSchemaTemplateId()TemplategetUpperTemplate()get upper template of this node, remember we get nearest template alone this node to rootbooleanhasChild(java.lang.String name)check whether the MNode has a child with the namebooleanisUseTemplate()voidmoveDataToNewMNode(IMNode newMNode)voidreplaceChild(java.lang.String oldChildName, IMNode newChildNode)Replace a child of this mnode.voidserializeTo(MLogWriter logWriter)voidsetChildren(IMNodeContainer children)voidsetSchemaTemplate(Template schemaTemplate)voidsetSchemaTemplateId(int schemaTemplateId)voidsetUseTemplate(boolean useTemplate)-
Methods inherited from class org.apache.iotdb.db.metadata.mnode.MNode
equals, getAsEntityMNode, getAsMeasurementMNode, getAsStorageGroupMNode, getCacheEntry, getFullPath, getName, getParent, getPartialPath, getTriggerExecutor, getUpperTriggerExecutorList, hashCode, isEntity, isMeasurement, isStorageGroup, setCacheEntry, setFullPath, setName, setParent, setTriggerExecutor, toString
-
-
-
-
Field Detail
-
children
protected transient volatile IMNodeContainer children
use in Measurement Node so it's protected suppress warnings reason: volatile for double synchronized checkThis will be a ConcurrentHashMap instance
-
schemaTemplateId
protected int schemaTemplateId
-
schemaTemplate
protected Template schemaTemplate
-
-
Constructor Detail
-
InternalMNode
public InternalMNode(IMNode parent, java.lang.String name)
Constructor of MNode.
-
-
Method Detail
-
hasChild
public boolean hasChild(java.lang.String name)
check whether the MNode has a child with the name
-
getChild
public IMNode getChild(java.lang.String name)
get the child with the name
-
addChild
public IMNode addChild(java.lang.String name, IMNode child)
add a child to current mnode- Parameters:
name- child's namechild- child's node- Returns:
- the child of this node after addChild
-
addChild
public IMNode addChild(IMNode child)
Add a child to the current mnode.This method will not take the child's name as one of the inputs and will also make this Mnode be child node's parent. All is to reduce the probability of mistaken by users and be more convenient for users to use. And the return of this method is used to conveniently construct a chain of time series for users.
- Parameters:
child- child's node- Returns:
- return the MNode already added
-
deleteChild
public IMNode deleteChild(java.lang.String name)
delete a child
-
replaceChild
public void replaceChild(java.lang.String oldChildName, IMNode newChildNode)Replace a child of this mnode. New child's name must be the same as old child's name.- Parameters:
oldChildName- measurement namenewChildNode- new child node
-
moveDataToNewMNode
public void moveDataToNewMNode(IMNode newMNode)
- Specified by:
moveDataToNewMNodein interfaceIMNode- Overrides:
moveDataToNewMNodein classMNode
-
getChildren
public IMNodeContainer getChildren()
-
setChildren
public void setChildren(IMNodeContainer children)
-
getUpperTemplate
public Template getUpperTemplate()
get upper template of this node, remember we get nearest template alone this node to root- Returns:
- upper template
-
getSchemaTemplateId
public int getSchemaTemplateId()
-
setSchemaTemplateId
public void setSchemaTemplateId(int schemaTemplateId)
-
getMNodeType
public MNodeType getMNodeType(java.lang.Boolean isConfig)
-
getSchemaTemplate
public Template getSchemaTemplate()
-
setSchemaTemplate
public void setSchemaTemplate(Template schemaTemplate)
-
isUseTemplate
public boolean isUseTemplate()
- Specified by:
isUseTemplatein interfaceIMNode- Overrides:
isUseTemplatein classMNode
-
setUseTemplate
public void setUseTemplate(boolean useTemplate)
-
serializeTo
public void serializeTo(MLogWriter logWriter) throws java.io.IOException
- Throws:
java.io.IOException
-
accept
public <R,C> R accept(MNodeVisitor<R,C> visitor, C context)
-
deserializeFrom
public static InternalMNode deserializeFrom(MNodePlan plan)
-
-