mirror of
git://holbrook.no/eth-monitor.git
synced 2024-11-21 12:06:45 +01:00
Add memory state store
This commit is contained in:
parent
c2d8a03483
commit
7d5f2d9b4e
@ -1,3 +1,5 @@
|
||||
- 0.4.2
|
||||
* Implement non-persistent (in-memory) sync state
|
||||
- 0.4.1
|
||||
* Correct too restrictive python version constraint
|
||||
- 0.4.0
|
||||
|
@ -1,3 +1,3 @@
|
||||
[syncer]
|
||||
loop_interval = 5
|
||||
backend = fs
|
||||
backend = mem
|
||||
|
@ -95,6 +95,7 @@ if args.list_backends:
|
||||
for v in [
|
||||
'fs',
|
||||
'rocksdb',
|
||||
'mem',
|
||||
]:
|
||||
print(v)
|
||||
sys.exit(0)
|
||||
@ -396,20 +397,28 @@ def main():
|
||||
|
||||
syncer_store_module = None
|
||||
syncer_store_class = None
|
||||
if config.get('SYNCER_BACKEND') == 'fs':
|
||||
syncer_store_module = importlib.import_module('chainsyncer.store.fs')
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncFsStore')
|
||||
elif config.get('SYNCER_BACKEND') == 'rocksdb':
|
||||
syncer_store_module = importlib.import_module('chainsyncer.store.rocksdb')
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncRocksDbStore')
|
||||
state_dir = None
|
||||
if config.get('SYNCER_BACKEND') == 'mem':
|
||||
syncer_store_module = importlib.import_module('chainsyncer.store.mem')
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncMemStore')
|
||||
else:
|
||||
syncer_store_module = importlib.import_module(config.get('SYNCER_BACKEND'))
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncStore')
|
||||
if config.get('SYNCER_BACKEND') == 'fs':
|
||||
syncer_store_module = importlib.import_module('chainsyncer.store.fs')
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncFsStore')
|
||||
elif config.get('SYNCER_BACKEND') == 'rocksdb':
|
||||
syncer_store_module = importlib.import_module('chainsyncer.store.rocksdb')
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncRocksDbStore')
|
||||
else:
|
||||
syncer_store_module = importlib.import_module(config.get('SYNCER_BACKEND'))
|
||||
syncer_store_class = getattr(syncer_store_module, 'SyncStore')
|
||||
state_dir = os.path.join(config.get('_STATE_DIR'), config.get('SYNCER_BACKEND'))
|
||||
|
||||
logg.info('using engine {} module {}.{}'.format(config.get('SYNCER_BACKEND'), syncer_store_module.__file__, syncer_store_class.__name__))
|
||||
|
||||
state_dir = os.path.join(config.get('_STATE_DIR'), config.get('SYNCER_BACKEND'))
|
||||
sync_store = syncer_store_class(state_dir, session_id=config.get('_SESSION_ID'), state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback)
|
||||
if state_dir == None:
|
||||
sync_store = syncer_store_class(session_id=config.get('_SESSION_ID'), state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback)
|
||||
else:
|
||||
sync_store = syncer_store_class(state_dir, session_id=config.get('_SESSION_ID'), state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback)
|
||||
logg.info('session is {}'.format(sync_store.session_id))
|
||||
|
||||
for fltr in filters:
|
||||
|
@ -1,6 +1,6 @@
|
||||
chainlib-eth>=0.1.0b4,<0.2.0
|
||||
chainlib>=0.1.0b1,<0.2.0
|
||||
chainsyncer~=0.3.2
|
||||
chainsyncer~=0.3.5
|
||||
eth-erc20~=0.2.0
|
||||
leveldir~=0.3.0
|
||||
eth-cache~=0.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user