Class 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 Detail

      • children

        protected transient volatile IMNodeContainer children
        use in Measurement Node so it's protected suppress warnings reason: volatile for double synchronized check

        This 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 name
        child - 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 name
        newChildNode - new child node
      • 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)
      • 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)