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