class AsyncDBPreProxy(BaseAsyncDB): """ Proxy implementation of ``BaseAsyncDB`` that does not derive from ``BaseProxy`` for the purpose of improved testability. """ _exposed_ = ( '__contains__', '__delitem__', '__getitem__', '__setitem__', 'atomic_batch', 'coro_set', 'coro_exists', 'delete', 'exists', 'get', 'set', ) def __init__(self) -> None: pass coro_set = async_method('set') coro_exists = async_method('exists') def get(self, key: bytes) -> bytes: return self._callmethod('get', (key,)) def __getitem__(self, key: bytes) -> bytes: return self._callmethod('__getitem__', (key,)) def set(self, key: bytes, value: bytes) -> None: return self._callmethod('set', (key, value)) def __setitem__(self, key: bytes, value: bytes) -> None: return self._callmethod('__setitem__', (key, value)) def delete(self, key: bytes) -> None: return self._callmethod('delete', (key,)) def __delitem__(self, key: bytes) -> None: return self._callmethod('__delitem__', (key,)) def exists(self, key: bytes) -> bool: return self._callmethod('exists', (key,)) def __contains__(self, key: bytes) -> bool: return self._callmethod('__contains__', (key,)) @contextmanager def atomic_batch(self) -> Generator['AtomicDBWriteBatch', None, None]: with AtomicDBWriteBatch._commit_unless_raises(self) as readable_batch: yield readable_batch
class DBProxy(BaseProxy): _exposed_ = ( '__contains__', '__delitem__', '__getitem__', '__setitem__', 'atomic_batch', 'coro_set', 'coro_exists', 'delete', 'exists', 'get', 'set', ) coro_set = async_method('set') coro_exists = async_method('exists') def get(self, key: bytes) -> bytes: return self._callmethod('get', (key, )) def __getitem__(self, key: bytes) -> bytes: return self._callmethod('__getitem__', (key, )) def set(self, key: bytes, value: bytes) -> None: return self._callmethod('set', (key, value)) def __setitem__(self, key: bytes, value: bytes) -> None: return self._callmethod('__setitem__', (key, value)) def delete(self, key: bytes) -> None: return self._callmethod('delete', (key, )) def __delitem__(self, key: bytes) -> None: return self._callmethod('__delitem__', (key, )) def exists(self, key: bytes) -> bool: return self._callmethod('exists', (key, )) def __contains__(self, key: bytes) -> bool: return self._callmethod('__contains__', (key, )) @contextmanager def atomic_batch(self) -> Generator['AtomicDBWriteBatch', None, None]: with AtomicDBWriteBatch._commit_unless_raises(self) as readable_batch: yield readable_batch
class AsyncHeaderDBPreProxy(BaseAsyncHeaderDB): """ Proxy implementation of ``BaseAsyncHeaderDB`` that does not derive from ``BaseProxy`` for the purpose of improved testability. """ def __init__(self, db: BaseAtomicDB) -> None: pass coro_get_block_header_by_hash = async_method('get_block_header_by_hash') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_get_canonical_block_header_by_number = async_method( 'get_canonical_block_header_by_number') coro_get_canonical_head = async_method('get_canonical_head') coro_get_score = async_method('get_score') coro_header_exists = async_method('header_exists') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_persist_header = async_method('persist_header') coro_persist_header_chain = async_method('persist_header_chain')
class AsyncHeaderDBProxy(BaseProxy, BaseAsyncHeaderDB, BaseHeaderDB): coro_get_block_header_by_hash = async_method('get_block_header_by_hash') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_get_canonical_block_header_by_number = async_method('get_canonical_block_header_by_number') coro_get_canonical_head = async_method('get_canonical_head') coro_get_score = async_method('get_score') coro_header_exists = async_method('header_exists') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_persist_header = async_method('persist_header') coro_persist_header_chain = async_method('persist_header_chain') get_block_header_by_hash = sync_method('get_block_header_by_hash') get_canonical_block_hash = sync_method('get_canonical_block_hash') get_canonical_block_header_by_number = sync_method('get_canonical_block_header_by_number') get_canonical_head = sync_method('get_canonical_head') get_score = sync_method('get_score') header_exists = sync_method('header_exists') get_canonical_block_hash = sync_method('get_canonical_block_hash') persist_header = sync_method('persist_header') persist_header_chain = sync_method('persist_header_chain')
class AsyncBeaconChainDBPreProxy(BaseAsyncBeaconChainDB): """ Proxy implementation of ``BaseAsyncBeaconChainDB`` that does not derive from ``BaseProxy`` for the purpose of improved testability. """ coro_persist_block = async_method('persist_block') coro_get_canonical_block_root = async_method('get_canonical_block_root') coro_get_canonical_block_by_slot = async_method( 'get_canonical_block_by_slot') coro_get_canonical_head = async_method('get_canonical_head') coro_get_canonical_head_root = async_method('get_canonical_head_root') coro_get_finalized_head = async_method('get_finalized_head') coro_get_block_by_root = async_method('get_block_by_root') coro_get_score = async_method('get_score') coro_block_exists = async_method('block_exists') coro_persist_block_chain = async_method('persist_block_chain') coro_get_state_by_root = async_method('get_state_by_root') coro_persist_state = async_method('persist_state') coro_exists = async_method('exists') coro_get = async_method('get')
class AsyncChainDBPreProxy(BaseAsyncChainDB): """ Proxy implementation of ``BaseAsyncChainDB`` that does not derive from ``BaseProxy`` for the purpose of improved testability. """ def __init__(self, db: BaseAtomicDB) -> None: pass coro_get = async_method('get') coro_get_block_header_by_hash = async_method('get_block_header_by_hash') coro_get_canonical_head = async_method('get_canonical_head') coro_get_score = async_method('get_score') coro_header_exists = async_method('header_exists') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_get_canonical_block_header_by_number = async_method( 'get_canonical_block_header_by_number') coro_persist_header = async_method('persist_header') coro_persist_block = async_method('persist_block') coro_persist_uncles = async_method('persist_uncles') coro_persist_trie_data_dict = async_method('persist_trie_data_dict') coro_get_block_transactions = async_method('get_block_transactions') coro_get_block_uncles = async_method('get_block_uncles') coro_get_receipts = async_method('get_receipts') add_receipt = sync_method('add_receipt') add_transaction = sync_method('add_transaction') exists = sync_method('exists') get = sync_method('get') get_block_header_by_hash = sync_method('get_block_header_by_hash') get_block_transactions = sync_method('get_block_transactions') get_block_transaction_hashes = sync_method('get_block_transaction_hashes') get_block_uncles = sync_method('get_block_uncles') get_canonical_head = sync_method('get_canonical_head') get_receipt_by_index = sync_method('get_receipt_by_index') get_receipts = sync_method('get_receipts') get_score = sync_method('get_score') get_transaction_by_index = sync_method('get_transaction_by_index') get_transaction_index = sync_method('get_transaction_index') header_exists = sync_method('header_exists') get_canonical_block_header_by_number = sync_method( 'get_canonical_block_header_by_number') get_canonical_block_hash = sync_method('get_canonical_block_hash') persist_block = sync_method('persist_block') persist_header = sync_method('persist_header') persist_header_chain = sync_method('persist_header_chain') persist_uncles = sync_method('persist_uncles') persist_trie_data_dict = sync_method('persist_trie_data_dict')
class ChainDBProxy(BaseProxy): coro_get = async_method('get') coro_get_block_header_by_hash = async_method('get_block_header_by_hash') coro_get_canonical_head = async_method('get_canonical_head') coro_get_score = async_method('get_score') coro_header_exists = async_method('header_exists') coro_get_canonical_block_hash = async_method('get_canonical_block_hash') coro_get_canonical_block_header_by_number = async_method( 'get_canonical_block_header_by_number') coro_persist_header = async_method('persist_header') coro_persist_block = async_method('persist_block') coro_persist_uncles = async_method('persist_uncles') coro_persist_trie_data_dict = async_method('persist_trie_data_dict') coro_get_block_transactions = async_method('get_block_transactions') coro_get_block_uncles = async_method('get_block_uncles') coro_get_receipts = async_method('get_receipts') get = sync_method('get') get_block_header_by_hash = sync_method('get_block_header_by_hash') get_canonical_head = sync_method('get_canonical_head') get_score = sync_method('get_score') header_exists = sync_method('header_exists') get_canonical_block_hash = sync_method('get_canonical_block_hash') persist_header = sync_method('persist_header') persist_uncles = sync_method('persist_uncles') persist_trie_data_dict = sync_method('persist_trie_data_dict')