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 org.apache.hadoop.classification.InterfaceAudience;
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  @InterfaceAudience.Private
37  class InternalScan extends Scan {
38    private boolean memOnly = false;
39    private boolean filesOnly = false;
40  
41    /**
42     * @param get get to model scan after
43     */
44    public InternalScan(Get get) {
45      super(get);
46    }
47  
48    /**
49     * StoreFiles will not be scanned. Only MemStore will be scanned.
50     */
51    public void checkOnlyMemStore() {
52      memOnly = true;
53      filesOnly = false;
54    }
55  
56    /**
57     * MemStore will not be scanned. Only StoreFiles will be scanned.
58     */
59    public void checkOnlyStoreFiles() {
60      memOnly = false;
61      filesOnly = true;
62    }
63  
64    /**
65     * Returns true if only the MemStore should be checked.  False if not.
66     * @return true to only check MemStore
67     */
68    public boolean isCheckOnlyMemStore() {
69      return (memOnly);
70    }
71  
72    /**
73     * Returns true if only StoreFiles should be checked.  False if not.
74     * @return true if only check StoreFiles
75     */
76    public boolean isCheckOnlyStoreFiles() {
77      return (filesOnly);
78    }
79  }