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  
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.HColumnDescriptor;
23  import org.apache.hadoop.hbase.KeyValue.KVComparator;
24  import org.apache.hadoop.hbase.util.Bytes;
25  import org.apache.hadoop.hbase.util.ClassSize;
26  
27  /**
28   * Immutable information for scans over a store.
29   */
30  @InterfaceAudience.Private
31  public class ScanInfo {
32    private byte[] family;
33    private int minVersions;
34    private int maxVersions;
35    private long ttl;
36    private boolean keepDeletedCells;
37    private long timeToPurgeDeletes;
38    private KVComparator comparator;
39  
40    public static final long FIXED_OVERHEAD = ClassSize.align(ClassSize.OBJECT
41        + (2 * ClassSize.REFERENCE) + (2 * Bytes.SIZEOF_INT)
42        + (2 * Bytes.SIZEOF_LONG) + Bytes.SIZEOF_BOOLEAN);
43  
44    /**
45     * @param family {@link HColumnDescriptor} describing the column family
46     * @param ttl Store's TTL (in ms)
47     * @param timeToPurgeDeletes duration in ms after which a delete marker can
48     *        be purged during a major compaction.
49     * @param comparator The store's comparator
50     */
51    public ScanInfo(final HColumnDescriptor family, final long ttl, final long timeToPurgeDeletes,
52        final KVComparator comparator) {
53      this(family.getName(), family.getMinVersions(), family.getMaxVersions(), ttl, family
54          .getKeepDeletedCells(), timeToPurgeDeletes, comparator);
55    }
56  
57    /**
58     * @param family Name of this store's column family
59     * @param minVersions Store's MIN_VERSIONS setting
60     * @param maxVersions Store's VERSIONS setting
61     * @param ttl Store's TTL (in ms)
62     * @param timeToPurgeDeletes duration in ms after which a delete marker can
63     *        be purged during a major compaction.
64     * @param keepDeletedCells Store's keepDeletedCells setting
65     * @param comparator The store's comparator
66     */
67    public ScanInfo(final byte[] family, final int minVersions, final int maxVersions,
68        final long ttl, final boolean keepDeletedCells, final long timeToPurgeDeletes,
69        final KVComparator comparator) {
70      this.family = family;
71      this.minVersions = minVersions;
72      this.maxVersions = maxVersions;
73      this.ttl = ttl;
74      this.keepDeletedCells = keepDeletedCells;
75      this.timeToPurgeDeletes = timeToPurgeDeletes;
76      this.comparator = comparator;
77    }
78  
79    public byte[] getFamily() {
80      return family;
81    }
82  
83    public int getMinVersions() {
84      return minVersions;
85    }
86  
87    public int getMaxVersions() {
88      return maxVersions;
89    }
90  
91    public long getTtl() {
92      return ttl;
93    }
94  
95    public boolean getKeepDeletedCells() {
96      return keepDeletedCells;
97    }
98  
99    public long getTimeToPurgeDeletes() {
100     return timeToPurgeDeletes;
101   }
102 
103   public KVComparator getComparator() {
104     return comparator;
105   }
106 }