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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 package org
.apache
.hadoop
.hbase
.regionserver
;
21 import java
.io
.IOException
;
22 import java
.util
.List
;
24 import org
.apache
.hadoop
.hbase
.Cell
;
25 import org
.apache
.hadoop
.hbase
.HBaseInterfaceAudience
;
26 import org
.apache
.hadoop
.hbase
.client
.RegionInfo
;
27 import org
.apache
.yetus
.audience
.InterfaceAudience
;
28 import org
.apache
.yetus
.audience
.InterfaceStability
;
31 * RegionScanner describes iterators over rows in an HRegion.
33 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience
.COPROC
)
34 @InterfaceStability.Evolving
35 public interface RegionScanner
extends InternalScanner
{
37 * @return The RegionInfo for this scanner.
39 RegionInfo
getRegionInfo();
42 * @return True if a filter indicates that this scanner will return no further rows.
43 * @throws IOException in case of I/O failure on a filter.
45 boolean isFilterDone() throws IOException
;
48 * Do a reseek to the required row. Should not be used to seek to a key which
49 * may come before the current position. Always seeks to the beginning of a
53 * @throws IllegalArgumentException
57 boolean reseek(byte[] row
) throws IOException
;
60 * @return The preferred max buffersize. See
61 * {@link org.apache.hadoop.hbase.client.Scan#setMaxResultSize(long)}
63 long getMaxResultSize();
66 * @return The Scanner's MVCC readPt see {@link MultiVersionConcurrencyControl}
68 long getMvccReadPoint();
71 * @return The limit on the number of cells to retrieve on each call to next(). See
72 * {@link org.apache.hadoop.hbase.client.Scan#setBatch(int)}
77 * @return The Scanner's {@link org.apache.hadoop.hbase.client.Scan#ID_ATRIBUTE} value,
80 default String
getOperationId() {
85 * Grab the next row's worth of values. This is a special internal method to be called from
86 * coprocessor hooks to avoid expensive setup. Caller must set the thread's readpoint, start and
87 * close a region operation, an synchronize on the scanner object. Caller should maintain and
88 * update metrics. See {@link #nextRaw(List, ScannerContext)}
89 * @param result return output array
90 * @return true if more rows exist after this one, false if scanner is done
91 * @throws IOException e
93 boolean nextRaw(List
<Cell
> result
) throws IOException
;
96 * Grab the next row's worth of values. The {@link ScannerContext} is used to enforce and track
97 * any limits associated with this call. Any progress that exists in the {@link ScannerContext}
98 * prior to calling this method will be LOST if {@link ScannerContext#getKeepProgress()} is false.
99 * Upon returning from this method, the {@link ScannerContext} will contain information about the
100 * progress made towards the limits. This is a special internal method to be called from
101 * coprocessor hooks to avoid expensive setup. Caller must set the thread's readpoint, start and
102 * close a region operation, an synchronize on the scanner object. Example: <code>
103 * HRegion region = ...;
104 * RegionScanner scanner = ...
105 * MultiVersionConcurrencyControl.setThreadReadPoint(scanner.getMvccReadPoint());
106 * region.startRegionOperation();
108 * synchronized(scanner) {
110 * boolean moreRows = scanner.nextRaw(values);
114 * region.closeRegionOperation();
117 * @param result return output array
118 * @param scannerContext The {@link ScannerContext} instance encapsulating all limits that should
119 * be tracked during calls to this method. The progress towards these limits can be
120 * tracked within this instance.
121 * @return true if more rows exist after this one, false if scanner is done
122 * @throws IOException e
124 boolean nextRaw(List
<Cell
> result
, ScannerContext scannerContext
)