File: test_memtable.py

package info (click to toggle)
python-rocksdb 0.8.0~rc3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 480 kB
  • sloc: python: 798; cpp: 408; makefile: 158
file content (29 lines) | stat: -rw-r--r-- 762 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# content of test_sample.py
import rocksdb
import pytest
import shutil
import os
import tempfile

def test_open_skiplist_memtable_factory():
    opts = rocksdb.Options()
    opts.memtable_factory = rocksdb.SkipListMemtableFactory()
    opts.create_if_missing = True

    loc = tempfile.mkdtemp()
    try:
        test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
    finally:
        shutil.rmtree(loc)


def test_open_vector_memtable_factory():
    opts = rocksdb.Options()
    opts.allow_concurrent_memtable_write = False
    opts.memtable_factory = rocksdb.VectorMemtableFactory()
    opts.create_if_missing = True
    loc = tempfile.mkdtemp()
    try:
        test_db = rocksdb.DB(os.path.join(loc, "test"), opts)
    finally:
        shutil.rmtree(loc)