Skip to content

Commit 3eca12d

Browse files
committed
Cover eth.db.* in API docs
1 parent bdabb9e commit 3eca12d

File tree

10 files changed

+114
-26
lines changed

10 files changed

+114
-26
lines changed

docs/api/api.db.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ DataBase
77
:name: toc-eth-api-db
88
:caption: Database
99

10-
db/api.db.backends
1110
db/api.db.account
11+
db/api.db.atomic
12+
db/api.db.backends
13+
db/api.db.batch
14+
db/api.db.cache
15+
db/api.db.chain
16+
db/api.db.diff
17+
db/api.db.header
1218
db/api.db.journal
13-
db/api.db.chain
19+
db/api.db.schema
20+
db/api.db.storage

docs/api/db/api.db.atomic.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Atomic
2+
======
3+
4+
AtomicDB
5+
~~~~~~~~
6+
7+
.. autoclass:: eth.db.atomic.AtomicDB
8+
:members:
9+
10+
11+
.. autoclass:: eth.db.atomic.AtomicDBWriteBatch
12+
:members:
13+

docs/api/db/api.db.batch.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Batch
2+
=====
3+
4+
BatchDB
5+
~~~~~~~
6+
7+
.. autoclass:: eth.db.batch.BatchDB
8+
:members:

docs/api/db/api.db.cache.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Cache
2+
=====
3+
4+
CacheDB
5+
~~~~~~~
6+
7+
.. autoclass:: eth.db.cache.CacheDB
8+
:members:

docs/api/db/api.db.diff.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
DBDiff
2+
======
3+
4+
DBDiff
5+
~~~~~~
6+
7+
.. autoclass:: eth.db.diff.DBDiff
8+
:members:
9+
10+
DBDiffTracker
11+
~~~~~~~~~~~~~
12+
13+
.. autoclass:: eth.db.diff.DBDiffTracker
14+
:members:
15+
16+
DiffMissingError
17+
~~~~~~~~~~~~~~~~
18+
19+
.. autoclass:: eth.db.diff.DiffMissingError
20+
:members:
21+
22+

docs/api/db/api.db.header.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Header
2+
======
3+
4+
HeaderDB
5+
~~~~~~~~
6+
7+
.. autoclass:: eth.db.header.HeaderDB
8+
:members:

docs/api/db/api.db.schema.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Schema
2+
======
3+
4+
SchemaV1
5+
--------
6+
7+
.. autoclass:: eth.db.schema.SchemaV1
8+
:members:

docs/api/db/api.db.storage.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Storage
2+
=======
3+
4+
AccountStorageDB
5+
----------------
6+
7+
.. autoclass:: eth.db.storage.AccountStorageDB
8+
:members:
9+
10+
StorageLookup
11+
-------------
12+
13+
.. autoclass:: eth.db.storage.StorageLookup
14+
:members:

eth/abc.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,28 @@ def is_genesis(self) -> bool:
255255
...
256256

257257

258+
class SchemaAPI(ABC):
259+
@staticmethod
260+
@abstractmethod
261+
def make_canonical_head_hash_lookup_key() -> bytes:
262+
...
263+
264+
@staticmethod
265+
@abstractmethod
266+
def make_block_number_to_hash_lookup_key(block_number: BlockNumber) -> bytes:
267+
...
268+
269+
@staticmethod
270+
@abstractmethod
271+
def make_block_hash_to_score_lookup_key(block_hash: Hash32) -> bytes:
272+
...
273+
274+
@staticmethod
275+
@abstractmethod
276+
def make_transaction_hash_to_block_lookup_key(transaction_hash: Hash32) -> bytes:
277+
...
278+
279+
258280
class DatabaseAPI(MutableMapping[bytes, bytes], ABC):
259281
@abstractmethod
260282
def set(self, key: bytes, value: bytes) -> None:

eth/db/schema.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
1-
from abc import ABC, abstractmethod
2-
31
from eth_typing import (
42
BlockNumber,
53
Hash32,
64
)
75

8-
9-
class BaseSchema(ABC):
10-
@staticmethod
11-
@abstractmethod
12-
def make_canonical_head_hash_lookup_key() -> bytes:
13-
raise NotImplementedError('Must be implemented by subclasses')
14-
15-
@staticmethod
16-
@abstractmethod
17-
def make_block_number_to_hash_lookup_key(block_number: BlockNumber) -> bytes:
18-
raise NotImplementedError('Must be implemented by subclasses')
19-
20-
@staticmethod
21-
@abstractmethod
22-
def make_block_hash_to_score_lookup_key(block_hash: Hash32) -> bytes:
23-
raise NotImplementedError('Must be implemented by subclasses')
24-
25-
@staticmethod
26-
@abstractmethod
27-
def make_transaction_hash_to_block_lookup_key(transaction_hash: Hash32) -> bytes:
28-
raise NotImplementedError('Must be implemented by subclasses')
6+
from eth.abc import SchemaAPI
297

308

31-
class SchemaV1(BaseSchema):
9+
class SchemaV1(SchemaAPI):
3210
@staticmethod
3311
def make_canonical_head_hash_lookup_key() -> bytes:
3412
return b'v1:canonical_head_hash'

0 commit comments

Comments
 (0)