Git Product home page Git Product logo

bloomfilter's Introduction

BloomFilter_x64实现

仿照Cassandra中的BloomFilter实现,Hash选用MurmurHash2,通过双重散列公式生成散列函数

  Hash(key, i) = (H1(key) + i * H2(key)) % m

版本历史

BloomFilter使用例子

  static BaseBloomFilter stBloomFilter = {0};

  // 初始化BloomFilter(容纳100,000元素,假阳概率不超过万分之一):
  InitBloomFilter(&stBloomFilter, 0, 100000, 0.00001);
  // 重置BloomFilter:
  ResetBloomFilter(&stBloomFilter);
  // 释放BloomFilter:
  FreeBloomFilter(&stBloomFilter);

  // 向BloomFilter中新增一个数值(0-正常,1-加入数值过多):
  uint32_t dwValue;
  iRet = BloomFilter_Add(&stBloomFilter, &dwValue, sizeof(uint32_t));

  // 检查数值是否在BloomFilter内(0-存在,1-不存在):
  iRet = BloomFilter_Check(&stBloomFilter, &dwValue, sizeof(uint32_t));

  // (1.1新增) 将生成好的BloomFilter写入文件:
  iRet = SaveBloomFilterToFile(&stBloomFilter, "dump.bin")
  // (1.1新增) 从文件读取生成好的BloomFilter:
  iRet = LoadBloomFilterFromFile(&stBloomFilter, "dump.bin")

bloomfilter's People

Contributors

upbit avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.