View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import java.io.Closeable;
22  import java.io.IOException;
23  import java.util.List;
24  
25  import org.apache.hadoop.hbase.Cell;
26  import org.apache.hadoop.hbase.classification.InterfaceAudience;
27  
28  /**
29   * Internal scanners differ from client-side scanners in that they operate on
30   * HStoreKeys and byte[] instead of RowResults. This is because they are
31   * actually close to how the data is physically stored, and therefore it is more
32   * convenient to interact with them that way. It is also much easier to merge
33   * the results across SortedMaps than RowResults.
34   *
35   * <p>Additionally, we need to be able to determine if the scanner is doing
36   * wildcard column matches (when only a column family is specified or if a
37   * column regex is specified) or if multiple members of the same column family
38   * were specified. If so, we need to ignore the timestamp to ensure that we get
39   * all the family members, as they may have been last updated at different
40   * times.
41   */
42  @InterfaceAudience.Private
43  public interface InternalScanner extends Closeable {
44    /**
45     * Grab the next row's worth of values.
46     * @param results return output array
47     * @return true if more rows exist after this one, false if scanner is done
48     * @throws IOException e
49     */
50    boolean next(List<Cell> results) throws IOException;
51  
52    /**
53     * Grab the next row's worth of values.
54     * @param result return output array
55     * @param scannerContext
56     * @return true if more rows exist after this one, false if scanner is done
57     * @throws IOException e
58     */
59    boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException;
60  
61    /**
62     * Closes the scanner and releases any resources it has allocated
63     * @throws IOException
64     */
65    void close() throws IOException;
66  }