4
0
mirror of git://holbrook.no/eth-monitor.git synced 2024-11-23 20:26:45 +01:00

Add memory state store

This commit is contained in:
lash 2022-04-26 08:32:56 +00:00
parent c2d8a03483
commit 7d5f2d9b4e
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 24 additions and 13 deletions

View File

@ -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

View File

@ -1,3 +1,3 @@
[syncer]
loop_interval = 5
backend = fs
backend = mem

View File

@ -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:

View File

@ -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

View File

@ -1,6 +1,6 @@
[metadata]
name = eth-monitor
version = 0.4.1
version = 0.4.2
description = Monitor and cache transactions using match filters
author = Louis Holbrook
author_email = dev@holbrook.no