Backends

BaseDB

class eth.db.backends.base.BaseDB(*args, **kwds)

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.

MemoryDB

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