View Javadoc

1   /**
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.regionserver;
21  
22  import org.apache.hadoop.hbase.client.Get;
23  import org.apache.hadoop.hbase.client.Scan;
24  
25  /**
26   * Special internal-only scanner, currently used for increment operations to
27   * allow additional server-side arguments for Scan operations.
28   * <p>
29   * Rather than adding new options/parameters to the public Scan API, this new
30   * class has been created.
31   * <p>
32   * Supports adding an option to only read from the MemStore with
33   * {@link #checkOnlyMemStore()} or to only read from StoreFiles with
34   * {@link #checkOnlyStoreFiles()}.
35   */
36  class InternalScan extends Scan {
37    private boolean memOnly = false;
38    private boolean filesOnly = false;
39  
40    /**
41     * @param get get to model scan after
42     */
43    public InternalScan(Get get) {
44      super(get);
45    }
46  
47    /**
48     * StoreFiles will not be scanned. Only MemStore will be scanned.
49     */
50    public void checkOnlyMemStore() {
51      memOnly = true;
52      filesOnly = false;
53    }
54  
55    /**
56     * MemStore will not be scanned. Only StoreFiles will be scanned.
57     */
58    public void checkOnlyStoreFiles() {
59      memOnly = false;
60      filesOnly = true;
61    }
62  
63    /**
64     * Returns true if only the MemStore should be checked.  False if not.
65     * @return true to only check MemStore
66     */
67    public boolean isCheckOnlyMemStore() {
68      return (memOnly);
69    }
70  
71    /**
72     * Returns true if only StoreFiles should be checked.  False if not.
73     * @return true if only check StoreFiles
74     */
75    public boolean isCheckOnlyStoreFiles() {
76      return (filesOnly);
77    }
78  }