public class TsFileResource extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
maxPlanIndex
Maximum index of plans executed within this TsFile.
|
protected long |
minPlanIndex
Minimum index of plans executed within this TsFile.
|
protected TsFileResource |
next |
protected TsFileResource |
prev
Used in
TsFileResourceList |
static String |
RESOURCE_SUFFIX |
protected TsFileResourceStatus |
status |
protected ITimeIndex |
timeIndex
time index
|
static byte |
VERSION_NUMBER
version number
|
| 构造器和说明 |
|---|
TsFileResource() |
TsFileResource(File file)
for sealed TsFile, call setClosed to close TsFileResource
|
TsFileResource(File file,
Map<String,Integer> deviceToIndex,
long[] startTimes,
long[] endTimes) |
TsFileResource(File file,
TsFileProcessor processor)
unsealed TsFile, for writter
|
TsFileResource(Map<PartialPath,List<ReadOnlyMemChunk>> pathToReadOnlyMemChunkMap,
Map<PartialPath,List<IChunkMetadata>> pathToChunkMetadataListMap,
TsFileResource originTsFileResource)
unsealed TsFile, for query
|
TsFileResource(PartialPath path,
List<ReadOnlyMemChunk> readOnlyMemChunk,
List<IChunkMetadata> chunkMetadataList,
TsFileResource originTsFileResource)
unsealed TsFile, for query
|
TsFileResource(TsFileResource other) |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
calculateRamSize() |
void |
close() |
static int |
compareFileName(TsFileResource o1,
TsFileResource o2) |
int |
compareIndexDegradePriority(TsFileResource tsFileResource) |
TsFileResource |
createHardlink()
Create a hardlink for the TsFile and modification file (if exists) The hardlink will have a
suffix like ".
|
long |
degradeTimeIndex()
the DeviceTimeIndex degrade to FileTimeIndex and release memory
|
void |
delete() |
void |
deserialize()
deserialize from disk
|
void |
deserializeFromOldFile()
deserialize tsfile resource from old file
|
boolean |
equals(Object o) |
List<IChunkMetadata> |
getChunkMetadataList(PartialPath seriesPath) |
ModificationFile |
getCompactionModFile() |
Set<String> |
getDevices() |
long |
getEndTime(String deviceId)
open file's end time is Long.MIN_VALUE
|
long |
getFileEndTime()
open file's end time is Long.MIN_VALUE
|
long |
getFileStartTime() |
static int |
getInnerCompactionCount(String fileName) |
long |
getMaxPlanIndex() |
long |
getMinPlanIndex() |
ModificationFile |
getModFile() |
long |
getOrderTime(String deviceId,
boolean ascending) |
long |
getRamSize() |
List<ReadOnlyMemChunk> |
getReadOnlyMemChunk(PartialPath seriesPath) |
VirtualStorageGroupProcessor.SettleTsFileCallBack |
getSettleTsFileCallBack() |
long |
getStartTime(String deviceId) |
byte |
getTimeIndexType() |
long |
getTimePartition()
make sure Either the deviceToIndex is not empty Or the path contains a partition folder
|
long |
getTimePartitionWithCheck()
Used when load new TsFiles not generated by the server Check and get the time partition
|
ITimeSeriesMetadata |
getTimeSeriesMetadata(PartialPath seriesPath)
Get a timeseriesMetadata by path.
|
File |
getTsFile() |
String |
getTsFilePath() |
long |
getTsFileSize() |
List<TsFileResource> |
getUpgradedResources() |
VirtualStorageGroupProcessor.UpgradeTsFileResourceCallBack |
getUpgradeTsFileResourceCallBack() |
long |
getVersion() |
int |
hashCode() |
boolean |
isClosed() |
boolean |
isCompacting() |
boolean |
isCompactionCandidate() |
boolean |
isDeleted() |
boolean |
isDeviceIdExist(String deviceId) |
boolean |
isFileInList() |
boolean |
isPlanIndexOverlap(TsFileResource another) |
boolean |
isPlanRangeCovers(TsFileResource another) |
boolean |
isSatisfied(String deviceId,
Filter timeFilter,
boolean isSeq,
long ttl,
boolean debug) |
boolean |
isSatisfied(String deviceId,
Filter timeFilter,
TsFileFilter fileFilter,
boolean isSeq,
boolean debug) |
boolean |
isSeq() |
boolean |
isSpanMultiTimePartitions()
Check whether the tsFile spans multiple time partitions.
|
boolean |
mayContainsDevice(String device)
Whether this TsFileResource contains this device, if false, it must not contain this device, if
true, it may or may not contain this device
|
void |
readLock()
If originTsFileResource is not null, we should acquire the read lock of originTsFileResource
before construct the current TsFileResource
|
void |
readUnlock() |
boolean |
remove()
Remove the data file, its resource file, and its modification file physically.
|
void |
removeModFile() |
boolean |
removeResourceFile() |
void |
resetModFile() |
boolean |
resourceFileExists() |
void |
serialize() |
void |
setFile(File file) |
void |
setMaxPlanIndex(long maxPlanIndex) |
void |
setMinPlanIndex(long minPlanIndex) |
void |
setModFile(ModificationFile modFile) |
void |
setProcessor(TsFileProcessor processor) |
void |
setSeq(boolean seq) |
void |
setSettleTsFileCallBack(VirtualStorageGroupProcessor.SettleTsFileCallBack settleTsFileCallBack) |
void |
setStatus(TsFileResourceStatus status) |
void |
setTimeIndex(ITimeIndex timeIndex) |
void |
setTimeIndexType(byte type) |
void |
setTimeSeriesMetadata(PartialPath path,
ITimeSeriesMetadata timeSeriesMetadata) |
void |
setUpgradedResources(List<TsFileResource> upgradedResources) |
void |
setUpgradeTsFileResourceCallBack(VirtualStorageGroupProcessor.UpgradeTsFileResourceCallBack upgradeTsFileResourceCallBack) |
void |
setVersion(long version) |
boolean |
stillLives(long timeLowerBound)
check if any of the device lives over the given time bound.
|
String |
toString() |
boolean |
tryReadLock() |
boolean |
tryWriteLock() |
void |
updateEndTime(String device,
long time) |
void |
updatePlanIndexes(long planIndex) |
void |
updatePlanIndexes(TsFileResource another)
For merge, the index range of the new file should be the union of all files' in this merge.
|
void |
updateStartTime(String device,
long time) |
void |
writeLock() |
void |
writeUnlock() |
public static final byte VERSION_NUMBER
protected TsFileResource prev
TsFileResourceListprotected TsFileResource next
protected ITimeIndex timeIndex
protected volatile TsFileResourceStatus status
protected long maxPlanIndex
protected long minPlanIndex
public TsFileResource()
public TsFileResource(TsFileResource other) throws IOException
IOExceptionpublic TsFileResource(File file)
public TsFileResource(File file, TsFileProcessor processor)
public TsFileResource(PartialPath path, List<ReadOnlyMemChunk> readOnlyMemChunk, List<IChunkMetadata> chunkMetadataList, TsFileResource originTsFileResource) throws IOException
IOExceptionpublic TsFileResource(Map<PartialPath,List<ReadOnlyMemChunk>> pathToReadOnlyMemChunkMap, Map<PartialPath,List<IChunkMetadata>> pathToChunkMetadataListMap, TsFileResource originTsFileResource) throws IOException
IOExceptionpublic void serialize()
throws IOException
IOExceptionpublic void deserialize()
throws IOException
IOExceptionpublic void deserializeFromOldFile()
throws IOException
IOExceptionpublic void updateStartTime(String device, long time)
public void updateEndTime(String device, long time)
public boolean resourceFileExists()
public List<IChunkMetadata> getChunkMetadataList(PartialPath seriesPath)
public List<ReadOnlyMemChunk> getReadOnlyMemChunk(PartialPath seriesPath)
public ModificationFile getModFile()
public ModificationFile getCompactionModFile()
public void resetModFile()
public void setFile(File file)
public File getTsFile()
public String getTsFilePath()
public long getTsFileSize()
public long getStartTime(String deviceId)
public long getEndTime(String deviceId)
public long getOrderTime(String deviceId, boolean ascending)
public long getFileStartTime()
public long getFileEndTime()
public boolean mayContainsDevice(String device)
public boolean isClosed()
public void close()
throws IOException
IOExceptionpublic void writeLock()
public void writeUnlock()
public void readLock()
public void readUnlock()
public boolean tryWriteLock()
public boolean tryReadLock()
public void removeModFile()
throws IOException
IOExceptionpublic boolean remove()
public boolean removeResourceFile()
public boolean isDeleted()
public boolean isCompacting()
public boolean isCompactionCandidate()
public void setStatus(TsFileResourceStatus status)
public boolean stillLives(long timeLowerBound)
public boolean isDeviceIdExist(String deviceId)
public boolean isSatisfied(String deviceId, Filter timeFilter, boolean isSeq, long ttl, boolean debug)
public boolean isSatisfied(String deviceId, Filter timeFilter, TsFileFilter fileFilter, boolean isSeq, boolean debug)
public void setProcessor(TsFileProcessor processor)
public ITimeSeriesMetadata getTimeSeriesMetadata(PartialPath seriesPath)
public void setTimeSeriesMetadata(PartialPath path, ITimeSeriesMetadata timeSeriesMetadata)
public void setUpgradedResources(List<TsFileResource> upgradedResources)
public List<TsFileResource> getUpgradedResources()
public void setUpgradeTsFileResourceCallBack(VirtualStorageGroupProcessor.UpgradeTsFileResourceCallBack upgradeTsFileResourceCallBack)
public VirtualStorageGroupProcessor.UpgradeTsFileResourceCallBack getUpgradeTsFileResourceCallBack()
public VirtualStorageGroupProcessor.SettleTsFileCallBack getSettleTsFileCallBack()
public void setSettleTsFileCallBack(VirtualStorageGroupProcessor.SettleTsFileCallBack settleTsFileCallBack)
public long getTimePartition()
public long getTimePartitionWithCheck()
throws PartitionViolationException
PartitionViolationException - if the data of the file spans partitions or it is emptypublic boolean isSpanMultiTimePartitions()
public TsFileResource createHardlink()
public void setModFile(ModificationFile modFile)
public long calculateRamSize()
public void delete()
throws IOException
IOExceptionpublic long getMaxPlanIndex()
public long getMinPlanIndex()
public void updatePlanIndexes(long planIndex)
public static int getInnerCompactionCount(String fileName) throws IOException
IOExceptionpublic void updatePlanIndexes(TsFileResource another)
public boolean isPlanIndexOverlap(TsFileResource another)
public boolean isPlanRangeCovers(TsFileResource another)
public void setMaxPlanIndex(long maxPlanIndex)
public void setMinPlanIndex(long minPlanIndex)
public void setVersion(long version)
public long getVersion()
public void setTimeIndex(ITimeIndex timeIndex)
public static int compareFileName(TsFileResource o1, TsFileResource o2)
public void setSeq(boolean seq)
public boolean isSeq()
public int compareIndexDegradePriority(TsFileResource tsFileResource)
public byte getTimeIndexType()
public void setTimeIndexType(byte type)
public long getRamSize()
public long degradeTimeIndex()
public boolean isFileInList()
Copyright © 2022 The Apache Software Foundation. All rights reserved.