このソフトウェアはフラッシュストレージに最適化されたPure PythonのKVSです。
This software is Pure Python KVS optimized for flash storage.
Python 3.6以上が必要です。 You need Python 3.6 or higher.
$ pip3 install f2db
>>> import f2db
>>> db = f2db.f2db('/tmp/f2db')
>>> db.save(key='foo', val=['bar', 1, 2, None, True])
>>> db.get('foo')
['bar', 1, 2, None, True]
>>> db.save(key='baz', val='2nd-value')
>>> list(db.get_iter())
['2nd-value', ['bar', 1, 2, None, True]]
>>> db.exists(key='baz')
True
>>> db.exists(key='vaz')
False
keyはstr型、valはpythonのpickleでシリアライズできるオブジェクト型を受け付けることができます。
Val can accept object types that can be serialized with pickle, key must to be str type.
-
- ファイルシステムベースのKVS/File system based KVS
-
- LevelDBやRocksDBに比べ並列アクセス、並列書き込みに強い(完全性は保証していない)/ Stronger in parallel access and parallel writing than LevelDB and RocksDB (completeness is not guaranteed)
-
- Pythonのオブジェクトをそのまま保存、復元できる/ You can save and restore Python objects as they are
Provides good performance when processing is heavy considering parallel processing
NFSでリモートのSSDをマウントして、多くのURLインデックスを共有してウェブページをスクレイピングするとき、データを効率的に格納するのに用いることができる。
It can be used to efficiently store data when mounting remote SSDs with NFS and sharing many URL indexes and scraping web pages.