Skip to main content

Trie on RocksDB

Project description

rocktrie

A trie library based on a single RocksDB database

Usage

>>> import rocksdb
>>> from rocktrie import list_to_trie_db, lookup, ROW_KEY, TERMINAL_KEY, PAYLOAD_KEY
>>> db = rocksdb.DB('/tmp/trie1', rocksdb.Options(create_if_missing=True))
>>> list_to_trie_db([("CAT", 100), ("RAT", 200), ("DOG", 300)], db)
>>> lookup(db, 0, 0, "O")
>>> 
>>> lookup(db, 0, 0, "C")
[0, False, None]
>>> lookup(db, 0, 1, "A")
[0, False, None]
>>> lookup(db, 0, 2, "T")
[0, True, 100]
>>> 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rocktrie-0.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

rocktrie-0.0.1-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page