public int getFileTierLevel(File file) {
    // If the file does not exist on Local disk, it is assumed be on remote Object Storage
    if (!file.exists()) {
      return getTiersNum() - 1;
    }
    Path filePath;
    try {
      filePath = file.getCanonicalFile().toPath();
    } catch (IOException e) {
      logger.error("Fail to get canonical path of data dir {}", file, e);
      filePath = file.toPath();
    }

    for (Map.Entry<String, Integer> entry : seqDir2TierLevel.entrySet()) {
      if (filePath.startsWith(entry.getKey())) {
        return entry.getValue();
      }
    }
    for (Map.Entry<String, Integer> entry : unSeqDir2TierLevel.entrySet()) {
      if (filePath.startsWith(entry.getKey())) {
        return entry.getValue();
      }
    }
    return 0;
  }
total space of each tier, Long.MAX_VALUE when one tier contains remote storage
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java