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.Cell;
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   * @param result return output array
045   * @return true if more rows exist after this one, false if scanner is done
046   * @throws IOException e
047   */
048  default boolean next(List<Cell> result) throws IOException {
049    return next(result, NoLimitScannerContext.getInstance());
050  }
051
052  /**
053   * Grab the next row's worth of values.
054   * @param result return output array
055   * @return true if more rows exist after this one, false if scanner is done
056   * @throws IOException e
057   */
058  boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException;
059
060  /**
061   * Closes the scanner and releases any resources it has allocated
062   */
063  @Override
064  void close() throws IOException;
065}