|
|
@ -1,13 +1,23 @@ |
|
|
|
"""This module contains the ETH_DB class, which the base database used by |
|
|
|
"""This module contains the ETH_DB class, which the base database used by |
|
|
|
pyethereum.""" |
|
|
|
pyethereum.""" |
|
|
|
import plyvel |
|
|
|
|
|
|
|
from ethereum.db import BaseDB |
|
|
|
from ethereum.db import BaseDB |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
has_plyvel = True |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
import plyvel |
|
|
|
|
|
|
|
except ImportError: |
|
|
|
|
|
|
|
has_plyvel = False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ETH_DB(BaseDB): |
|
|
|
class ETH_DB(BaseDB): |
|
|
|
"""Adopts pythereum BaseDB using plyvel.""" |
|
|
|
"""Adopts pythereum BaseDB using plyvel.""" |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, path): |
|
|
|
def __init__(self, path): |
|
|
|
|
|
|
|
if has_plyvel is False: |
|
|
|
|
|
|
|
raise ImportError( |
|
|
|
|
|
|
|
"Plyvel is not installed, please install plyvel and leveldb" |
|
|
|
|
|
|
|
) |
|
|
|
self.db = plyvel.DB(path) |
|
|
|
self.db = plyvel.DB(path) |
|
|
|
|
|
|
|
|
|
|
|
def get(self, key): |
|
|
|
def get(self, key): |
|
|
|