Backends

BaseDB

class eth.db.backends.base.BaseDB

This is an abstract key/value lookup with all bytes values, with some convenience methods for databases. As much as possible, you can use a DB as if it were a dict.

Notable exceptions are that you cannot iterate through all values or get the length. (Unless a subclass explicitly enables it).

All subclasses must implement these methods: __init__, __getitem__, __setitem__, __delitem__

Subclasses may optionally implement an _exists method that is type-checked for key and value.

delete(key: bytes) → None

Delete the given key from the database.

exists(key: bytes) → bool

Return True if the key exists in the database, otherwise False.

set(key: bytes, value: bytes) → None

Assign the value to the key.

LevelDB

class eth.db.backends.level.LevelDB(db_path: pathlib.Path = None, max_open_files: int = None)
atomic_batch() → Iterator[eth.abc.AtomicWriteBatchAPI]

Return a ContextManager to write an atomic batch to the database.

MemoryDB

class eth.db.backends.memory.MemoryDB(kv_store: Dict[bytes, bytes] = None)