Skip to content

Ruby data structures that use constant memory by spilling to disk after crossing a size threshold.

License

Notifications You must be signed in to change notification settings

sutrolabs/anansi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anansi - A hybrid Ruby Set using memory and Disk (using sqlite3) for large sized tasks

He lifted the pot over his head and threw it on the ground. The pot crashed on the ground and the wisdom blew far and wide all over the earth. And this is how wisdom came to the world (or your disk).

- Kiren Babal (Anansi and the Wisdom Pot)

Why?

A Ruby Set in memory isn't great for huge tasks. But a disk based Set is too slow for everything. We need the best of both worlds.

What?

Data structures that use constant memory by spilling to disk after crossing a size threshold.

Currently the only supported data structure is AppendSet.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add anansi

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install anansi

Usage

Add items to an AppendSet:

append_set = Anansi::AppendSet.new
append_set.add(['foo', 'bar', 'buzz'])

Check if an item exists in an AppendSet:

append_set.include? 'foo'

Get the size of an AppendSet:

append_set.size

(If you need other data structures, stay tuned and watch our org.)

License

The gem is available as open source under the terms of the MIT License.

Feedback

Source code available on Github. Feedback and pull requests are greatly appreciated. Let us know if we can improve this.

From

👋 The folks at Census originally put this together. Have data? We'll sync your data warehouse with your CRM and other apps critical to your team. Interested in what we do? Come work with us.

About

Ruby data structures that use constant memory by spilling to disk after crossing a size threshold.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages