001/*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.hbase.io.hfile;
021
022import org.apache.yetus.audience.InterfaceAudience;
023import org.apache.hadoop.hbase.util.BloomFilterBase;
024
025import org.apache.hadoop.hbase.CellComparator;
026
027@InterfaceAudience.Private
028public class CompoundBloomFilterBase implements BloomFilterBase {
029
030  /**
031   * At read time, the total number of chunks. At write time, the number of
032   * chunks created so far. The first chunk has an ID of 0, and the current
033   * chunk has the ID of numChunks - 1.
034   */
035  protected int numChunks;
036
037  /**
038   * The Bloom filter version. There used to be a DynamicByteBloomFilter which
039   * had version 2.
040   */
041  public static final int VERSION = 3;
042
043  /** Target error rate for configuring the filter and for information */
044  protected float errorRate;
045
046  /** The total number of keys in all chunks */
047  protected long totalKeyCount;
048  protected long totalByteSize;
049  protected long totalMaxKeys;
050
051  /** Hash function type to use, as defined in {@link org.apache.hadoop.hbase.util.Hash} */
052  protected int hashType;
053  /** Comparator used to compare Bloom filter keys */
054  protected CellComparator comparator;
055
056  @Override
057  public long getMaxKeys() {
058    return totalMaxKeys;
059  }
060
061  @Override
062  public long getKeyCount() {
063    return totalKeyCount;
064  }
065
066  @Override
067  public long getByteSize() {
068    return totalByteSize;
069  }
070
071}