Project

minisketch

0.0
No release in over a year
This is a Ruby wrapper for the libminisketch C library.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.15.5
 Project Readme

Minisketch binding for ruby Build Status Gem Version

This is a wrapper around libminisketch for efficient set reconciliation.

Installation

Install libminisketch

Since this library is an FFI wrapper, libminisketch must be installed beforehand.

If the library is installed in an unusual location, the environment variable [LIBMINISKETCH] can be used to specify the path to the library.

Install gem

Add this line to your application's Gemfile:

gem 'minisketch'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install minisketch

Usage

Functions exposed in libminisketch.h can be accessed using the Minisketch class.

require 'minisketch'

# Create new sketch
sketch = Minisketch.create(12, 0, 4)

# Add element to sketch
sketch.add(3000)
# or
sketch << 3001

# Serialize
sketch.serialize

# Decode
decoded = sketch.decode

another_sketch = Minisketch.create(12, 0, 4)
another_sketch << 3000
another_sketch << 3002

# Merge another sketch
sketch.merge(another_sketch)

This library has been tested based on commit a571ba2 of libminisketch.