mirror of
git://holbrook.no/eth-monitor.git
synced 2024-11-23 04:16:46 +01:00
Implement syncer context
This commit is contained in:
parent
270a35bada
commit
39ee38b0dc
@ -1,3 +1,6 @@
|
|||||||
|
- 0.8.1
|
||||||
|
* Implement syncer context
|
||||||
|
* Add key-value parameter for cli, environment, config to pass to syncer context
|
||||||
- 0.8.0
|
- 0.8.0
|
||||||
* Implement RPC batch limits for syncer
|
* Implement RPC batch limits for syncer
|
||||||
- 0.7.6
|
- 0.7.6
|
||||||
|
17
WAIVER
Normal file
17
WAIVER
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright waiver for the python package "eth-monitor"
|
||||||
|
|
||||||
|
I dedicate any and all copyright interest in this software to the
|
||||||
|
public domain. I make this dedication for the benefit of the public at
|
||||||
|
large and to the detriment of my heirs and successors. I intend this
|
||||||
|
dedication to be an overt act of relinquishment in perpetuity of all
|
||||||
|
present and future rights to this software under copyright law.
|
||||||
|
|
||||||
|
To the best of my knowledge and belief, my contributions are either
|
||||||
|
originally authored by me or are derived from prior works which I have
|
||||||
|
verified are also in the public domain and are not subject to claims
|
||||||
|
of copyright by other parties.
|
||||||
|
|
||||||
|
To the best of my knowledge and belief, no individual, business,
|
||||||
|
organization, government, or other entity has any copyright interest
|
||||||
|
in my contributions, and I affirm that I will not make contributions
|
||||||
|
that are otherwise encumbered.
|
29
WAIVER.asc
Normal file
29
WAIVER.asc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
-----BEGIN PGP MESSAGE-----
|
||||||
|
|
||||||
|
owGVU39QFFUc58fFwHYYYvwq0cfPoO6umsoEJgMJ4wQVGn7IiMje3ru7B7e7d/vj
|
||||||
|
rmMwS7iwMPImp8LUIGdATWgsHamjyYCQPGZkYEIkQ7QcEobRVIYGTXu7B2r1V3/c
|
||||||
|
zO2+7/fz8+2uYH+fQN+YwQn3jq7WNb5t/rwuoDhDW5T1GmW96YwDmazFwSGjSQB2
|
||||||
|
EtkgBwwsBwQTBBaHYGIZYCGpStII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
|
n3j8p6HkweaalIuPOXO+2fTh5pSgioo97tKZccVeNTFX+YHxRubnEVHK30d2Hld0
|
||||||
|
Dm1tWXewv35Prtv3eJNr7mNdUUZV650y99qm/ZdbHK9PehJXwpnJ0WXh8KP86pzc
|
||||||
|
ULfTj7bF6iOjFNn7mtq+GA8vS9mdN7G6wDX86IraTav+CANKD3K+cdD/4X5Tz+TR
|
||||||
|
puaCHyeH2p8nn7yotqTF5sc3xrV+0tOpGdgf1G1962bRr4eXj4vp9FiYx2rz+FWt
|
||||||
|
Ma14ObL5q3Mp57dUO/NqPjszd/tKEGcLnTibfCu9ovGMUFLa67owU852LVXWD96d
|
||||||
|
bLii2B7cdjhG8+KGn8vFAy+9N+tKczgzHa64wrxGd28XuzQ1avpEWu7Xa1NrL4Se
|
||||||
|
TrDqRq//DQ==
|
||||||
|
=yHWM
|
||||||
|
-----END PGP MESSAGE-----
|
@ -30,3 +30,6 @@ def process_args(argparser, args, flags):
|
|||||||
argparser.add_argument('--store-tx-data', action='store_true', dest='store_tx_data', help='Store tx data in cache store')
|
argparser.add_argument('--store-tx-data', action='store_true', dest='store_tx_data', help='Store tx data in cache store')
|
||||||
argparser.add_argument('--store-block-data', action='store_true', dest='store_block_data', help='Store block data in cache store')
|
argparser.add_argument('--store-block-data', action='store_true', dest='store_block_data', help='Store block data in cache store')
|
||||||
argparser.add_argument('--fresh', action='store_true', help='Do not read block and tx data from cache, even if available')
|
argparser.add_argument('--fresh', action='store_true', help='Do not read block and tx data from cache, even if available')
|
||||||
|
|
||||||
|
# misc flags
|
||||||
|
argparser.add_argument('-k', '--context-key', dest='context_key', action='append', type=str, help='Add a key-value pair to be added to the context')
|
||||||
|
@ -38,6 +38,8 @@ def process_config(config, arg, args, flags):
|
|||||||
|
|
||||||
arg_override['ETHMONITOR_STATE_DIR'] = getattr(args, 'state_dir')
|
arg_override['ETHMONITOR_STATE_DIR'] = getattr(args, 'state_dir')
|
||||||
|
|
||||||
|
arg_override['ETHMONITOR_CONTEXT_KEY'] = getattr(args, 'context_key')
|
||||||
|
|
||||||
arg_override['ETHCACHE_STORE_BLOCK'] = getattr(args, 'store_block_data')
|
arg_override['ETHCACHE_STORE_BLOCK'] = getattr(args, 'store_block_data')
|
||||||
arg_override['ETHCACHE_STORE_TX'] = getattr(args, 'store_tx_data')
|
arg_override['ETHCACHE_STORE_TX'] = getattr(args, 'store_tx_data')
|
||||||
|
|
||||||
|
@ -18,3 +18,4 @@ filter =
|
|||||||
block_filter =
|
block_filter =
|
||||||
include_default = 0
|
include_default = 0
|
||||||
state_dir = ./.eth-monitor
|
state_dir = ./.eth-monitor
|
||||||
|
context_key =
|
||||||
|
@ -85,6 +85,7 @@ config.add_schema_dir(chainsyncer_config_dir)
|
|||||||
config = process_config(config, arg, args, flags)
|
config = process_config(config, arg, args, flags)
|
||||||
config = process_config_sync(config, arg, args, flags)
|
config = process_config_sync(config, arg, args, flags)
|
||||||
config = eth_monitor.cli.process_config(config, arg, args, flags)
|
config = eth_monitor.cli.process_config(config, arg, args, flags)
|
||||||
|
logg.debug('loaded config:\n{}'.format(config))
|
||||||
|
|
||||||
settings = ChainSettings()
|
settings = ChainSettings()
|
||||||
settings = process_settings(settings, config)
|
settings = process_settings(settings, config)
|
||||||
@ -95,6 +96,7 @@ logg.debug('loaded settings:\n{}'.format(settings))
|
|||||||
def main():
|
def main():
|
||||||
logg.info('session is {}'.format(settings.get('SESSION_ID')))
|
logg.info('session is {}'.format(settings.get('SESSION_ID')))
|
||||||
|
|
||||||
|
|
||||||
drv = ChainInterfaceDriver(
|
drv = ChainInterfaceDriver(
|
||||||
settings.get('SYNC_STORE'),
|
settings.get('SYNC_STORE'),
|
||||||
settings.get('SYNCER_INTERFACE'),
|
settings.get('SYNCER_INTERFACE'),
|
||||||
@ -104,9 +106,9 @@ def main():
|
|||||||
post_callback=post_callback,
|
post_callback=post_callback,
|
||||||
block_callback=settings.get('BLOCK_HANDLER').filter,
|
block_callback=settings.get('BLOCK_HANDLER').filter,
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = drv.run(settings.get('CONN'))
|
r = drv.run(settings.get('CONN'), ctx=settings.get('SYNCER_CONTEXT'))
|
||||||
except SyncDone as e:
|
except SyncDone as e:
|
||||||
sys.stderr.write("sync {} done at block {}\n".format(drv, e))
|
sys.stderr.write("sync {} done at block {}\n".format(drv, e))
|
||||||
|
|
||||||
|
@ -380,11 +380,25 @@ def process_cache(settings, config):
|
|||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
|
||||||
|
def process_user_context(settings, config):
|
||||||
|
ctx_usr = {}
|
||||||
|
for kv in config.get('ETHMONITOR_CONTEXT_KEY'):
|
||||||
|
(k, v) = kv.split('=', 1)
|
||||||
|
ctx_usr[k] = v
|
||||||
|
ctx = {
|
||||||
|
'driver': 'eth-monitor',
|
||||||
|
'usr': ctx_usr,
|
||||||
|
}
|
||||||
|
settings.set('SYNCER_CONTEXT', ctx)
|
||||||
|
return settings
|
||||||
|
|
||||||
|
|
||||||
def process_settings(settings, config):
|
def process_settings(settings, config):
|
||||||
settings = process_monitor_session(settings, config)
|
settings = process_monitor_session(settings, config)
|
||||||
settings = process_monitor_session_dir(settings, config)
|
settings = process_monitor_session_dir(settings, config)
|
||||||
settings = process_arg_rules(settings, config)
|
settings = process_arg_rules(settings, config)
|
||||||
settings = process_sync(settings, config)
|
settings = process_sync(settings, config)
|
||||||
settings = process_cache(settings, config)
|
settings = process_cache(settings, config)
|
||||||
|
settings = process_user_context(settings, config)
|
||||||
settings = process_filter(settings, config)
|
settings = process_filter(settings, config)
|
||||||
return settings
|
return settings
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
chainlib-eth~=0.5.0
|
chainlib-eth~=0.5.0
|
||||||
chainlib~=0.5.0
|
chainlib~=0.5.0
|
||||||
chainsyncer~=0.8.0
|
chainsyncer~=0.8.1
|
||||||
leveldir~=0.3.0
|
leveldir~=0.3.0
|
||||||
eth-cache~=0.3.0
|
eth-cache~=0.3.0
|
||||||
confini~=0.6.3
|
confini~=0.6.3
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-monitor
|
name = eth-monitor
|
||||||
version = 0.8.0
|
version = 0.8.1
|
||||||
description = Monitor and cache transactions using match filters
|
description = Monitor and cache transactions using match filters
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user