Skip to content

allow db implementations to have iterable views #2073

@charles-cooper

Description

@charles-cooper

What is wrong?

currently, an AtomicDB cannot be iterated over. this makes it tricky to inspect, ex.

>>> t.env.vm.state._db.items()
ItemsView(<eth.db.atomic.AtomicDB object at 0x7fdf23f260e0>)
>>> list(t.env.vm.state._db.items())
NotImplementedError: By default, DB classes cannot return the total number of keys.

How can it be fixed

probably, add __iter__ and __len__ methods to all useful db classes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions