001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.regionserver;
020
021import java.io.Closeable;
022import java.io.IOException;
023import java.util.List;
024
025import org.apache.hadoop.hbase.Cell;
026import org.apache.hadoop.hbase.HBaseInterfaceAudience;
027import org.apache.yetus.audience.InterfaceAudience;
028import org.apache.yetus.audience.InterfaceStability;
029
030/**
031 * Internal scanners differ from client-side scanners in that they operate on
032 * HStoreKeys and byte[] instead of RowResults. This is because they are
033 * actually close to how the data is physically stored, and therefore it is more
034 * convenient to interact with them that way. It is also much easier to merge
035 * the results across SortedMaps than RowResults.
036 *
037 * <p>Additionally, we need to be able to determine if the scanner is doing
038 * wildcard column matches (when only a column family is specified or if a
039 * column regex is specified) or if multiple members of the same column family
040 * were specified. If so, we need to ignore the timestamp to ensure that we get
041 * all the family members, as they may have been last updated at different
042 * times.
043 */
044@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
045@InterfaceStability.Evolving
046public interface InternalScanner extends Closeable {
047  /**
048   * Grab the next row's worth of values.
049   * @param result return output array
050   * @return true if more rows exist after this one, false if scanner is done
051   * @throws IOException e
052   */
053  default boolean next(List<Cell> result) throws IOException {
054    return next(result, NoLimitScannerContext.getInstance());
055  }
056
057  /**
058   * Grab the next row's worth of values.
059   * @param result return output array
060   * @param scannerContext
061   * @return true if more rows exist after this one, false if scanner is done
062   * @throws IOException e
063   */
064  boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException;
065
066  /**
067   * Closes the scanner and releases any resources it has allocated
068   * @throws IOException
069   */
070  @Override
071  void close() throws IOException;
072}