• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FilterFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.utils.FilterFactory的典型用法代码示例。如果您正苦于以下问题:Java FilterFactory类的具体用法?Java FilterFactory怎么用?Java FilterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FilterFactory类属于org.apache.cassandra.utils包,在下文中一共展示了FilterFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: flushBf

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
void flushBf()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);

        try (HadoopFileUtils.HadoopFileChannel hos = HadoopFileUtils.newFilesystemChannel(path,
                                                                              descriptor.getConfiguration());
             DataOutputStreamPlus stream = new BufferedDataOutputStreamPlus(hos))
        {
            // bloom filter
            FilterFactory.serialize(bf, stream);
            stream.flush();
            //SyncUtil.sync(hos);
        }
        catch (IOException e)
        {
            logger.info(e.getMessage());
            throw new FSWriteError(e, path);
        }
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:26,代码来源:BigTableWriter.java


示例2: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount, final SequentialWriter dataFile)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(Component.PRIMARY_INDEX)));
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
    summary = new IndexSummaryBuilder(keyCount, metadata.getMinIndexInterval(), Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
    // register listeners to be alerted when the data files are flushed
    indexFile.setPostFlushListener(new Runnable()
    {
        public void run()
        {
            summary.markIndexSynced(indexFile.getLastFlushOffset());
        }
    });
    dataFile.setPostFlushListener(new Runnable()
    {
        public void run()
        {
            summary.markDataSynced(dataFile.getLastFlushOffset());
        }
    });
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:23,代码来源:SSTableWriter.java


示例3: load

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
private void load(ValidationMetadata validation) throws IOException
{
    if (metadata.getBloomFilterFpChance() == 1.0)
    {
        // bf is disabled.
        load(false, true);
        bf = FilterFactory.AlwaysPresent;
    }
    else if (!components.contains(Component.FILTER) || validation == null)
    {
        // bf is enabled, but filter component is missing.
        load(true, true);
    }
    else if (validation.bloomFilterFPChance != metadata.getBloomFilterFpChance())
    {
        // bf fp chance in sstable metadata and it has changed since compaction.
        load(true, true);
    }
    else
    {
        // bf is enabled and fp chance matches the currently configured value.
        load(false, true);
        loadBloomFilter();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:SSTableReader.java


示例4: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount, final SequentialWriter dataFile)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(Component.PRIMARY_INDEX)));
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode(), false);
    summary = new IndexSummaryBuilder(keyCount, metadata.params.minIndexInterval, Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.params.bloomFilterFpChance, true, descriptor.version.hasOldBfHashOrder());
    // register listeners to be alerted when the data files are flushed
    indexFile.setPostFlushListener(new Runnable()
    {
        public void run()
        {
            summary.markIndexSynced(indexFile.getLastFlushOffset());
        }
    });
    dataFile.setPostFlushListener(new Runnable()
    {
        public void run()
        {
            summary.markDataSynced(dataFile.getLastFlushOffset());
        }
    });
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:BigTableWriter.java


示例5: flushBf

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
void flushBf()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);
        try (FileOutputStream fos = new FileOutputStream(path);
             DataOutputStreamPlus stream = new BufferedDataOutputStreamPlus(fos))
        {
            // bloom filter
            FilterFactory.serialize(bf, stream);
            stream.flush();
            SyncUtil.sync(fos);
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, path);
        }
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:BigTableWriter.java


示例6: Version

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
public Version(String version)
{
    this.version = version;
    hasStringsInBloomFilter = version.compareTo("c") < 0;
    hasIntRowSize = version.compareTo("d") < 0;
    hasEncodedKeys = version.compareTo("e") < 0;
    metadataIncludesReplayPosition = version.compareTo("g") >= 0;
    hasCompressionRatio = version.compareTo("hb") >= 0;
    hasPartitioner = version.compareTo("hc") >= 0;
    tracksMaxTimestamp = version.compareTo("hd") >= 0;
    tracksMinTimestamp = version.compareTo("ib") >= 0;
    hasAncestors = version.compareTo("he") >= 0;
    metadataIncludesModernReplayPosition = version.compareTo("hf") >= 0;
    tracksTombstones = version.compareTo("ia") >= 0;
    hasPromotedIndexes = version.compareTo("ia") >= 0;
    isLatestVersion = version.compareTo(current_version) == 0;
    if (version.compareTo("f") < 0)
        filterType = FilterFactory.Type.SHA;
    else if (version.compareTo("ia") < 0)
        filterType = FilterFactory.Type.MURMUR2;
    else
        filterType = FilterFactory.Type.MURMUR3;
    hasRowLevelBF = version.compareTo("ic") < 0;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:25,代码来源:Descriptor.java


示例7: Version

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
public Version(String version) {
    this.version = version;
    hasStringsInBloomFilter = version.compareTo("c") < 0;
    hasIntRowSize = version.compareTo("d") < 0;
    hasEncodedKeys = version.compareTo("e") < 0;
    metadataIncludesReplayPosition = version.compareTo("g") >= 0;
    hasCompressionRatio = version.compareTo("hb") >= 0;
    hasPartitioner = version.compareTo("hc") >= 0;
    tracksMaxTimestamp = version.compareTo("hd") >= 0;
    tracksMinTimestamp = version.compareTo("ib") >= 0;
    hasAncestors = version.compareTo("he") >= 0;
    metadataIncludesModernReplayPosition = version.compareTo("hf") >= 0;
    tracksTombstones = version.compareTo("ia") >= 0;
    hasPromotedIndexes = version.compareTo("ia") >= 0;
    isLatestVersion = version.compareTo(current_version) == 0;
    if (version.compareTo("f") < 0)
        filterType = FilterFactory.Type.SHA;
    else if (version.compareTo("ia") < 0)
        filterType = FilterFactory.Type.MURMUR2;
    else
        filterType = FilterFactory.Type.MURMUR3;
    hasRowLevelBF = version.compareTo("ic") < 0;
}
 
开发者ID:fullcontact,项目名称:hadoop-sstable,代码行数:24,代码来源:Descriptor.java


示例8: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount)
{
    indexFile = new SequentialWriter(descriptor.filenameFor(Component.PRIMARY_INDEX),
                                     writerOption, descriptor.getConfiguration());
    builder = new FileHandle.Builder(descriptor.filenameFor(Component.PRIMARY_INDEX))
                            .withConfiguration(descriptor.getConfiguration());
    //chunkCache.ifPresent(builder::withChunkCache);
    summary = new IndexSummaryBuilder(keyCount, metadata.params.minIndexInterval, Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.params.bloomFilterFpChance, true,
                                 descriptor.version.hasOldBfHashOrder());
    // register listeners to be alerted when the data files are flushed
    indexFile.setPostFlushListener(() -> summary.markIndexSynced(indexFile.getLastFlushOffset()));
    dataFile.setPostFlushListener(() -> summary.markDataSynced(dataFile.getLastFlushOffset()));

}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:BigTableWriter.java


示例9: close

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
public void close()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);
        try
        {
            // bloom filter
            FileOutputStream fos = new FileOutputStream(path);
            DataOutputStreamPlus stream = new DataOutputStreamPlus(new BufferedOutputStream(fos));
            FilterFactory.serialize(bf, stream);
            stream.flush();
            fos.getFD().sync();
            stream.close();
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, path);
        }
    }

    // index
    long position = indexFile.getFilePointer();
    indexFile.close(); // calls force
    FileUtils.truncate(indexFile.getPath(), position);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:30,代码来源:SSTableWriter.java


示例10: loadBloomFilter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Load bloom filter from Filter.db file.
 *
 * @throws IOException
 */
private void loadBloomFilter() throws IOException
{
    DataInputStream stream = null;
    try
    {
        stream = new DataInputStream(new BufferedInputStream(new FileInputStream(descriptor.filenameFor(Component.FILTER))));
        bf = FilterFactory.deserialize(stream, true);
    }
    finally
    {
        FileUtils.closeQuietly(stream);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:SSTableReader.java


示例11: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_INDEX)),
                                      !metadata.populateIoCacheOnFlush());
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
    summary = new IndexSummaryBuilder(keyCount, metadata.getIndexInterval());
    bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:9,代码来源:SSTableWriter.java


示例12: close

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
public void close()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(SSTable.COMPONENT_FILTER);
        try
        {
            // bloom filter
            FileOutputStream fos = new FileOutputStream(path);
            DataOutputStream stream = new DataOutputStream(fos);
            FilterFactory.serialize(bf, stream);
            stream.flush();
            fos.getFD().sync();
            stream.close();
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, path);
        }
    }

    // index
    long position = indexFile.getFilePointer();
    indexFile.close(); // calls force
    FileUtils.truncate(indexFile.getPath(), position);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:30,代码来源:SSTableWriter.java


示例13: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(Component.PRIMARY_INDEX)));
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
    summary = new IndexSummaryBuilder(keyCount, metadata.getMinIndexInterval(), Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:8,代码来源:SSTableWriter.java


示例14: close

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
public void close()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);
        try
        {
            // bloom filter
            FileOutputStream fos = new FileOutputStream(path);
            DataOutputStreamAndChannel stream = new DataOutputStreamAndChannel(fos);
            FilterFactory.serialize(bf, stream);
            stream.flush();
            fos.getFD().sync();
            stream.close();
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, path);
        }
    }

    // index
    long position = indexFile.getFilePointer();
    indexFile.close(); // calls force
    FileUtils.truncate(indexFile.getPath(), position);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:30,代码来源:SSTableWriter.java


示例15: testMurmurBloomFilter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
@Test
public void testMurmurBloomFilter()
{
    Descriptor desc = Descriptor.fromFilename("Keyspace1-Standard1-hz-1-Data.db");
    assertEquals("hz", desc.version.toString());
    assertEquals(desc.version.filterType, FilterFactory.Type.MURMUR2);

    desc = Descriptor.fromFilename("Keyspace1-Standard1-ia-1-Data.db");
    assertEquals("ia", desc.version.toString());
    assertEquals(desc.version.filterType, FilterFactory.Type.MURMUR3);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:12,代码来源:DescriptorTest.java


示例16: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(Component.PRIMARY_INDEX)),
                                      !metadata.populateIoCacheOnFlush());
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
    summary = new IndexSummaryBuilder(keyCount, metadata.getIndexInterval(), Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:9,代码来源:SSTableWriter.java


示例17: close

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
public void close()
{
    if (components.contains(Component.FILTER))
    {
        String path = descriptor.filenameFor(Component.FILTER);
        try
        {
            // bloom filter
            FileOutputStream fos = new FileOutputStream(path);
            DataOutputStream stream = new DataOutputStream(fos);
            FilterFactory.serialize(bf, stream);
            stream.flush();
            fos.getFD().sync();
            stream.close();
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, path);
        }
    }

    // index
    long position = indexFile.getFilePointer();
    indexFile.close(); // calls force
    FileUtils.truncate(indexFile.getPath(), position);
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:30,代码来源:SSTableWriter.java


示例18: IndexWriter

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
IndexWriter(long keyCount)
{
    indexFile = SequentialWriter.open(new File(descriptor.filenameFor(Component.PRIMARY_INDEX)),
                                      !metadata.populateIoCacheOnFlush());
    builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
    summary = new IndexSummaryBuilder(keyCount, metadata.getMinIndexInterval(), Downsampling.BASE_SAMPLING_LEVEL);
    bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:9,代码来源:SSTableWriter.java


示例19: load

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
private void load(ValidationMetadata validation) throws IOException
{
    // bf is disabled.
    load(false, false);
    bf = FilterFactory.AlwaysPresent;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:SSTableReader.java


示例20: buildSummary

import org.apache.cassandra.utils.FilterFactory; //导入依赖的package包/类
/**
 * Build index summary(and optionally bloom filter) by reading through Index.db file.
 *
 * @param recreateBloomFilter true if recreate bloom filter
 * @param summaryLoaded true if index summary is already loaded and not need to build again
 * @throws IOException
 */
private void buildSummary(boolean recreateBloomFilter, boolean summaryLoaded, int samplingLevel) throws IOException
{
     if (!components.contains(Component.PRIMARY_INDEX))
         return;

    // we read the positions in a BRAF so we don't have to worry about an entry spanning a mmap boundary.
    try (RandomAccessReader primaryIndex = RandomAccessReader.open(descriptor.filenameFor(Component.PRIMARY_INDEX),
                                                                   descriptor.getConfiguration()))
    {
        long indexSize = primaryIndex.length();
        long histogramCount = sstableMetadata.estimatedPartitionSize.count();
        long estimatedKeys = histogramCount > 0 && !sstableMetadata.estimatedPartitionSize.isOverflowed()
                ? histogramCount
                : estimateRowsFromIndex(primaryIndex); // statistics is supposed to be optional

        if (recreateBloomFilter)
            bf = FilterFactory.getFilter(estimatedKeys, metadata.params.bloomFilterFpChance, true, descriptor.version.hasOldBfHashOrder());

        try (IndexSummaryBuilder summaryBuilder = summaryLoaded ? null : new IndexSummaryBuilder(estimatedKeys, metadata.params.minIndexInterval, samplingLevel))
        {
            long indexPosition;

            while ((indexPosition = primaryIndex.getFilePointer()) != indexSize)
            {
                ByteBuffer key = ByteBufferUtil.readWithShortLength(primaryIndex);
                RowIndexEntry.Serializer.skip(primaryIndex, descriptor.version);
                DecoratedKey decoratedKey = decorateKey(key);
                if (first == null)
                    first = decoratedKey;
                last = decoratedKey;

                if (recreateBloomFilter)
                    bf.add(decoratedKey);

                // if summary was already read from disk we don't want to re-populate it using primary index
                if (!summaryLoaded)
                {
                    summaryBuilder.maybeAddEntry(decoratedKey, indexPosition);
                }
            }

            if (!summaryLoaded)
                indexSummary = summaryBuilder.build(getPartitioner());
        }
    }

    first = getMinimalKey(first);
    last = getMinimalKey(last);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:57,代码来源:SSTableReader.java



注:本文中的org.apache.cassandra.utils.FilterFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QueryListener类代码示例发布时间:2022-05-22
下一篇:
Java BodyKind类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap