001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.regionserver; 019 020import java.io.IOException; 021import java.util.Optional; 022import java.util.OptionalLong; 023 024import org.apache.hadoop.fs.Path; 025import org.apache.hadoop.hbase.Cell; 026import org.apache.hadoop.hbase.CellComparator; 027import org.apache.hadoop.hbase.HBaseInterfaceAudience; 028import org.apache.yetus.audience.InterfaceAudience; 029import org.apache.yetus.audience.InterfaceStability; 030 031/** 032 * An interface to describe a store data file. 033 * <p> 034 * <strong>NOTICE: </strong>this interface is mainly designed for coprocessor, so it will not expose 035 * all the internal APIs for a 'store file'. If you are implementing something inside HBase, i.e, 036 * not a coprocessor hook, usually you should use {@link HStoreFile} directly as it is the only 037 * implementation of this interface. 038 */ 039@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 040@InterfaceStability.Evolving 041public interface StoreFile { 042 043 /** 044 * Get the first key in this store file. 045 */ 046 Optional<Cell> getFirstKey(); 047 048 /** 049 * Get the last key in this store file. 050 */ 051 Optional<Cell> getLastKey(); 052 053 /** 054 * Get the comparator for comparing two cells. 055 */ 056 CellComparator getComparator(); 057 058 /** 059 * Get max of the MemstoreTS in the KV's in this store file. 060 */ 061 long getMaxMemStoreTS(); 062 063 /** 064 * @return Path or null if this StoreFile was made with a Stream. 065 */ 066 Path getPath(); 067 068 /** 069 * @return Returns the qualified path of this StoreFile 070 */ 071 Path getQualifiedPath(); 072 073 /** 074 * @return True if this is a StoreFile Reference. 075 */ 076 boolean isReference(); 077 078 /** 079 * @return True if this is HFile. 080 */ 081 boolean isHFile(); 082 083 /** 084 * @return True if this file was made by a major compaction. 085 */ 086 boolean isMajorCompactionResult(); 087 088 /** 089 * @return True if this file should not be part of a minor compaction. 090 */ 091 boolean excludeFromMinorCompaction(); 092 093 /** 094 * @return This files maximum edit sequence id. 095 */ 096 long getMaxSequenceId(); 097 098 /** 099 * Get the modification time of this store file. Usually will access the file system so throws 100 * IOException. 101 * @deprecated Since 2.0.0. Will be removed in 3.0.0. 102 * @see #getModificationTimestamp() 103 */ 104 @Deprecated 105 long getModificationTimeStamp() throws IOException; 106 107 /** 108 * Get the modification time of this store file. Usually will access the file system so throws 109 * IOException. 110 */ 111 long getModificationTimestamp() throws IOException; 112 113 /** 114 * Check if this storefile was created by bulk load. When a hfile is bulk loaded into HBase, we 115 * append {@code '_SeqId_<id-when-loaded>'} to the hfile name, unless 116 * "hbase.mapreduce.bulkload.assign.sequenceNumbers" is explicitly turned off. If 117 * "hbase.mapreduce.bulkload.assign.sequenceNumbers" is turned off, fall back to 118 * BULKLOAD_TIME_KEY. 119 * @return true if this storefile was created by bulk load. 120 */ 121 boolean isBulkLoadResult(); 122 123 /** 124 * Return the timestamp at which this bulk load file was generated. 125 */ 126 OptionalLong getBulkLoadTimestamp(); 127 128 /** 129 * @return a length description of this StoreFile, suitable for debug output 130 */ 131 String toStringDetailed(); 132 133 /** 134 * Get the min timestamp of all the cells in the store file. 135 */ 136 OptionalLong getMinimumTimestamp(); 137 138 /** 139 * Get the max timestamp of all the cells in the store file. 140 */ 141 OptionalLong getMaximumTimestamp(); 142}