View Javadoc

1   /*
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
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
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.
17   */
18  package org.apache.hadoop.hbase.regionserver;
19  
20  import java.io.IOException;
21  import java.util.List;
22  
23  
24  import org.apache.hadoop.hbase.client.Get;
25  import org.apache.hadoop.hbase.client.Put;
26  import org.apache.hadoop.hbase.client.Result;
27  import org.apache.hadoop.hbase.client.ResultScanner;
28  import org.apache.hadoop.hbase.client.Scan;
29  import org.apache.omid.transaction.TableAccessWrapper;
30  
31  // This class wraps the Region object when doing server side filtering.
32  public class RegionAccessWrapper implements TableAccessWrapper {
33  
34      private final Region region;
35      
36      public RegionAccessWrapper(Region region) {
37          this.region = region;
38      }
39  
40      @Override
41      public Result[] get(List<Get> get) throws IOException {
42          Result[] results = new Result[get.size()];
43  
44          int i = 0;
45          for (Get g : get) {
46              results[i++] = region.get(g);
47          }
48          return results;
49      }
50  
51      @Override
52      public Result get(Get get) throws IOException {
53          return region.get(get);
54      }
55  
56      @Override
57      public void put(Put put) throws IOException {
58          region.put(put);
59      }
60  
61      @Override
62      public ResultScanner getScanner(Scan scan) throws IOException {
63          return null;
64      }
65  
66      @Override
67      public void close() throws Exception {
68  
69      }
70  }