Package org.apache.iotdb.db.metadata.tag
Class TagManager
- java.lang.Object
-
- org.apache.iotdb.db.metadata.tag.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 voidaddAttributes(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 timeseriesvoidaddIndex(java.lang.String tagKey, java.lang.String tagValue, IMeasurementMNode measurementMNode)voidaddIndex(java.util.Map<java.lang.String,java.lang.String> tagsMap, IMeasurementMNode measurementMNode)voidaddTags(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 timeseriesvoidclear()booleancreateSnapshot(java.io.File targetDir)voiddropTagsOrAttributes(java.util.Set<java.lang.String> keySet, org.apache.iotdb.commons.path.PartialPath fullPath, IMeasurementMNode leafMNode)drop tags or attributes of the timeseriesjava.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 TagManagerloadFromSnapshot(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)booleanrecoverIndex(long offset, IMeasurementMNode measurementMNode)voidremoveFromTagInvertedIndex(IMeasurementMNode node)remove the node from the tag inverted indexvoidremoveIndex(java.lang.String tagKey, java.lang.String tagValue, IMeasurementMNode measurementMNode)voidrenameTagOrAttributeKey(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 timeseriesvoidsetTagsOrAttributesValue(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 attributesvoidupdateTagsAndAttributes(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.longwriteTagFile(java.util.Map<java.lang.String,java.lang.String> tags, java.util.Map<java.lang.String,java.lang.String> attributes)
-
-
-
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.IOExceptionupsert 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.MetadataExceptionjava.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.IOExceptionadd new attributes key-value for the timeseries- Parameters:
attributesMap- newly added attributes map- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.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.IOExceptionadd new tags key-value for the timeseries- Parameters:
tagsMap- newly added tags mapfullPath- timeseries- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.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.IOExceptiondrop tags or attributes of the timeseries- Parameters:
keySet- tags key or attributes key- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.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.IOExceptionset/change the values of tags or attributes- Parameters:
alterMap- the new tags or attributes key-value- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.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.IOExceptionrename the tag or attribute's key of the timeseries- Parameters:
oldKey- old key of tag or attributenewKey- new key of tag or attribute- Throws:
org.apache.iotdb.commons.exception.MetadataExceptionjava.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.MetadataExceptionjava.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
-
-