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.Closeable; 021import java.io.IOException; 022import java.util.List; 023import org.apache.hadoop.hbase.ExtendedCell; 024import org.apache.hadoop.hbase.HBaseInterfaceAudience; 025import org.apache.yetus.audience.InterfaceAudience; 026import org.apache.yetus.audience.InterfaceStability; 027 028/** 029 * Internal scanners differ from client-side scanners in that they operate on HStoreKeys and byte[] 030 * instead of RowResults. This is because they are actually close to how the data is physically 031 * stored, and therefore it is more convenient to interact with them that way. It is also much 032 * easier to merge the results across SortedMaps than RowResults. 033 * <p> 034 * Additionally, we need to be able to determine if the scanner is doing wildcard column matches 035 * (when only a column family is specified or if a column regex is specified) or if multiple members 036 * of the same column family were specified. If so, we need to ignore the timestamp to ensure that 037 * we get all the family members, as they may have been last updated at different times. 038 */ 039@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 040@InterfaceStability.Evolving 041public interface InternalScanner extends Closeable { 042 /** 043 * Grab the next row's worth of values. 044 * <p> 045 * The generic type for the output list {@code result} means we will only add {@link ExtendedCell} 046 * to it. This is useful for the code in HBase as we can pass List<ExtendedCell> here to 047 * avoid casting, but may cause some troubles for coprocessors which implement this method. In 048 * general, all cells created via the {@link org.apache.hadoop.hbase.CellBuilder} are actually 049 * {@link ExtendedCell}s, so if you want to add something to the {@code result} list, you can just 050 * cast it to {@link ExtendedCell}, although it is marked as IA.Private. 051 * @param result return output array. We will only add ExtendedCell to this list, but for CP 052 * users, you'd better just use {@link org.apache.hadoop.hbase.RawCell} as 053 * {@link ExtendedCell} is IA.Private. 054 * @return true if more rows exist after this one, false if scanner is done 055 */ 056 default boolean next(List<? super ExtendedCell> result) throws IOException { 057 return next(result, NoLimitScannerContext.getInstance()); 058 } 059 060 /** 061 * Grab the next row's worth of values. 062 * <p> 063 * The generic type for the output list {@code result} means we will only add {@link ExtendedCell} 064 * to it. This is useful for the code in HBase as we can pass List<ExtendedCell> here to 065 * avoid casting, but may cause some troubles for coprocessors which implement this method. In 066 * general, all cells created via the {@link org.apache.hadoop.hbase.CellBuilder} are actually 067 * {@link ExtendedCell}s, so if you want to add something to the {@code result} list, you can just 068 * cast it to {@link ExtendedCell}, although it is marked as IA.Private. 069 * @param result return output array. We will only add ExtendedCell to this list, but for CP 070 * users, you'd better just use {@link org.apache.hadoop.hbase.RawCell} as 071 * {@link ExtendedCell} is IA.Private. 072 * @return true if more rows exist after this one, false if scanner is done 073 */ 074 boolean next(List<? super ExtendedCell> result, ScannerContext scannerContext) throws IOException; 075 076 /** 077 * Closes the scanner and releases any resources it has allocated 078 */ 079 @Override 080 void close() throws IOException; 081}