Class TagManager


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

      Constructors 
      Constructor Description
      TagManager​(java.lang.String sgSchemaDirPath)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAttributes​(java.util.Map<java.lang.String,​java.lang.String> attributesMap, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)
      add new attributes key-value for the timeseries
      void addIndex​(java.lang.String tagKey, java.lang.String tagValue, IMeasurementMNode measurementMNode)  
      void addIndex​(java.util.Map<java.lang.String,​java.lang.String> tagsMap, IMeasurementMNode measurementMNode)  
      void addTags​(java.util.Map<java.lang.String,​java.lang.String> tagsMap, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)
      add new tags key-value for the timeseries
      void clear()  
      boolean createSnapshot​(java.io.File targetDir)  
      void dropTagsOrAttributes​(java.util.Set<java.lang.String> keySet, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)
      drop tags or attributes of the timeseries
      java.util.List<java.lang.String> getMatchedTimeseriesInIndex​(java.lang.String key, java.lang.String value, boolean isContains)  
      java.util.List<IMeasurementMNode> getMatchedTimeseriesInIndex​(ShowTimeSeriesPlan plan, QueryContext context)  
      static TagManager loadFromSnapshot​(java.io.File snapshotDir, java.lang.String sgSchemaDirPath)  
      org.apache.iotdb.tsfile.utils.Pair<java.util.Map<java.lang.String,​java.lang.String>,​java.util.Map<java.lang.String,​java.lang.String>> readTagFile​(long tagFileOffset)  
      boolean recoverIndex​(long offset, IMeasurementMNode measurementMNode)  
      void removeFromTagInvertedIndex​(IMeasurementMNode node)
      remove the node from the tag inverted index
      void removeIndex​(java.lang.String tagKey, java.lang.String tagValue, IMeasurementMNode measurementMNode)  
      void renameTagOrAttributeKey​(java.lang.String oldKey, java.lang.String newKey, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)
      rename the tag or attribute's key of the timeseries
      void setTagsOrAttributesValue​(java.util.Map<java.lang.String,​java.lang.String> alterMap, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)
      set/change the values of tags or attributes
      void updateTagsAndAttributes​(java.util.Map<java.lang.String,​java.lang.String> tagsMap, java.util.Map<java.lang.String,​java.lang.String> attributesMap, IMeasurementMNode leafMNode)
      upsert tags and attributes key-value for the timeseries if the key has existed, just use the new value to update it.
      long writeTagFile​(java.util.Map<java.lang.String,​java.lang.String> tags, java.util.Map<java.lang.String,​java.lang.String> attributes)  
      • Methods inherited from class java.lang.Object

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

      • TagManager

        public TagManager​(java.lang.String sgSchemaDirPath)
                   throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • createSnapshot

        public boolean createSnapshot​(java.io.File targetDir)
      • loadFromSnapshot

        public static TagManager loadFromSnapshot​(java.io.File snapshotDir,
                                                  java.lang.String sgSchemaDirPath)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • recoverIndex

        public boolean recoverIndex​(long offset,
                                    IMeasurementMNode measurementMNode)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • addIndex

        public void addIndex​(java.lang.String tagKey,
                             java.lang.String tagValue,
                             IMeasurementMNode measurementMNode)
      • addIndex

        public void addIndex​(java.util.Map<java.lang.String,​java.lang.String> tagsMap,
                             IMeasurementMNode measurementMNode)
      • removeIndex

        public void removeIndex​(java.lang.String tagKey,
                                java.lang.String tagValue,
                                IMeasurementMNode measurementMNode)
      • getMatchedTimeseriesInIndex

        public java.util.List<java.lang.String> getMatchedTimeseriesInIndex​(java.lang.String key,
                                                                            java.lang.String value,
                                                                            boolean isContains)
      • getMatchedTimeseriesInIndex

        public java.util.List<IMeasurementMNode> getMatchedTimeseriesInIndex​(ShowTimeSeriesPlan plan,
                                                                             QueryContext context)
                                                                      throws org.apache.iotdb.commons.exception.MetadataException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • removeFromTagInvertedIndex

        public void removeFromTagInvertedIndex​(IMeasurementMNode node)
                                        throws java.io.IOException
        remove the node from the tag inverted index
        Throws:
        java.io.IOException
      • updateTagsAndAttributes

        public void updateTagsAndAttributes​(java.util.Map<java.lang.String,​java.lang.String> tagsMap,
                                            java.util.Map<java.lang.String,​java.lang.String> attributesMap,
                                            IMeasurementMNode leafMNode)
                                     throws org.apache.iotdb.commons.exception.MetadataException,
                                            java.io.IOException
        upsert tags and attributes key-value for the timeseries if the key has existed, just use the new value to update it.
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • addAttributes

        public void addAttributes​(java.util.Map<java.lang.String,​java.lang.String> attributesMap,
                                  org.apache.iotdb.commons.path.PartialPath fullPath,
                                  IMeasurementMNode leafMNode)
                           throws org.apache.iotdb.commons.exception.MetadataException,
                                  java.io.IOException
        add new attributes key-value for the timeseries
        Parameters:
        attributesMap - newly added attributes map
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • addTags

        public void addTags​(java.util.Map<java.lang.String,​java.lang.String> tagsMap,
                            org.apache.iotdb.commons.path.PartialPath fullPath,
                            IMeasurementMNode leafMNode)
                     throws org.apache.iotdb.commons.exception.MetadataException,
                            java.io.IOException
        add new tags key-value for the timeseries
        Parameters:
        tagsMap - newly added tags map
        fullPath - timeseries
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • dropTagsOrAttributes

        public void dropTagsOrAttributes​(java.util.Set<java.lang.String> keySet,
                                         org.apache.iotdb.commons.path.PartialPath fullPath,
                                         IMeasurementMNode leafMNode)
                                  throws org.apache.iotdb.commons.exception.MetadataException,
                                         java.io.IOException
        drop tags or attributes of the timeseries
        Parameters:
        keySet - tags key or attributes key
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • setTagsOrAttributesValue

        public void setTagsOrAttributesValue​(java.util.Map<java.lang.String,​java.lang.String> alterMap,
                                             org.apache.iotdb.commons.path.PartialPath fullPath,
                                             IMeasurementMNode leafMNode)
                                      throws org.apache.iotdb.commons.exception.MetadataException,
                                             java.io.IOException
        set/change the values of tags or attributes
        Parameters:
        alterMap - the new tags or attributes key-value
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • renameTagOrAttributeKey

        public void renameTagOrAttributeKey​(java.lang.String oldKey,
                                            java.lang.String newKey,
                                            org.apache.iotdb.commons.path.PartialPath fullPath,
                                            IMeasurementMNode leafMNode)
                                     throws org.apache.iotdb.commons.exception.MetadataException,
                                            java.io.IOException
        rename the tag or attribute's key of the timeseries
        Parameters:
        oldKey - old key of tag or attribute
        newKey - new key of tag or attribute
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • writeTagFile

        public long writeTagFile​(java.util.Map<java.lang.String,​java.lang.String> tags,
                                 java.util.Map<java.lang.String,​java.lang.String> attributes)
                          throws org.apache.iotdb.commons.exception.MetadataException,
                                 java.io.IOException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
        java.io.IOException
      • readTagFile

        public org.apache.iotdb.tsfile.utils.Pair<java.util.Map<java.lang.String,​java.lang.String>,​java.util.Map<java.lang.String,​java.lang.String>> readTagFile​(long tagFileOffset)
                                                                                                                                                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • clear

        public void clear()
                   throws java.io.IOException
        Throws:
        java.io.IOException