2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org
.apache
.hadoop
.hbase
.client
;
20 import java
.io
.IOException
;
22 import org
.apache
.yetus
.audience
.InterfaceAudience
;
25 * Used to separate the row constructing logic.
27 * After we add heartbeat support for scan, RS may return partial result even if allowPartial is
28 * false and batch is 0. With this interface, the implementation now looks like:
30 * <li>Get results from ScanResponse proto.</li>
31 * <li>Pass them to ScanResultCache and get something back.</li>
32 * <li>If we actually get something back, then pass it to ScanConsumer.</li>
35 @InterfaceAudience.Private
36 interface ScanResultCache
{
38 static final Result
[] EMPTY_RESULT_ARRAY
= new Result
[0];
41 * Add the given results to cache and get valid results back.
42 * @param results the results of a scan next. Must not be null.
43 * @param isHeartbeatMessage indicate whether the results is gotten from a heartbeat response.
44 * @return valid results, never null.
46 Result
[] addAndGet(Result
[] results
, boolean isHeartbeatMessage
) throws IOException
;
49 * Clear the cached result if any. Called when scan error and we will start from a start of a row
55 * Return the number of complete rows. Used to implement limited scan.
57 int numberOfCompleteRows();