Implement chainlib 0.3.0 structure
This commit is contained in:
parent
7d5ceb9a28
commit
88870dc12d
1
chainsyncer/__init__.py
Normal file
1
chainsyncer/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
from .filter import SyncFilter
|
@ -11,15 +11,14 @@ from chainlib.settings import ChainSettings
|
|||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ChainsyncerSettings(ChainSettings):
|
def process_sync_backend(settings, config):
|
||||||
|
settings.set('SYNCER_BACKEND', config.get('SYNCER_BACKEND'))
|
||||||
def process_sync_backend(self, config):
|
return settings
|
||||||
self.o['SYNCER_BACKEND'] = config.get('SYNCER_BACKEND')
|
|
||||||
|
|
||||||
|
|
||||||
def process_sync_range(self, config):
|
def process_sync_range(settings, config):
|
||||||
o = self.o['SYNCER_INTERFACE'].block_latest()
|
o = settings.get('SYNCER_INTERFACE').block_latest()
|
||||||
r = self.o['RPC'].do(o)
|
r = settings.get('CONN').do(o)
|
||||||
block_offset = int(strip_0x(r), 16) + 1
|
block_offset = int(strip_0x(r), 16) + 1
|
||||||
logg.info('network block height at startup is {}'.format(block_offset))
|
logg.info('network block height at startup is {}'.format(block_offset))
|
||||||
|
|
||||||
@ -29,9 +28,9 @@ class ChainsyncerSettings(ChainSettings):
|
|||||||
until = 0
|
until = 0
|
||||||
|
|
||||||
if config.true('_HEAD'):
|
if config.true('_HEAD'):
|
||||||
self.o['SYNCER_OFFSET'] = block_offset
|
settings.set('SYNCER_OFFSET', block_offset)
|
||||||
self.o['SYNCER_LIMIT'] = -1
|
settings.set('SYNCER_LIMIT', -1)
|
||||||
return
|
return settings
|
||||||
|
|
||||||
session_block_offset = int(config.get('SYNCER_OFFSET'))
|
session_block_offset = int(config.get('SYNCER_OFFSET'))
|
||||||
until = int(config.get('SYNCER_LIMIT'))
|
until = int(config.get('SYNCER_LIMIT'))
|
||||||
@ -51,5 +50,6 @@ class ChainsyncerSettings(ChainSettings):
|
|||||||
if block_limit == 0:
|
if block_limit == 0:
|
||||||
block_limit = block_offset
|
block_limit = block_offset
|
||||||
|
|
||||||
self.o['SYNCER_OFFSET'] = session_block_offset
|
settings.set('SYNCER_OFFSET', session_block_offset)
|
||||||
self.o['SYNCER_LIMIT'] = block_limit
|
settings.set('SYNCER_LIMIT', block_limit)
|
||||||
|
return settings
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
confini~=0.6.0
|
confini~=0.6.1
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
hexathon~=0.1.6
|
hexathon~=0.1.7
|
||||||
chainlib~=0.2.0
|
chainlib~=0.3.0
|
||||||
shep~=0.2.9
|
shep~=0.2.9
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainsyncer
|
name = chainsyncer
|
||||||
version = 0.4.10
|
version = 0.4.11
|
||||||
description = Generic blockchain syncer driver
|
description = Generic blockchain syncer driver
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
@ -30,6 +30,7 @@ packages =
|
|||||||
chainsyncer.store
|
chainsyncer.store
|
||||||
chainsyncer.cli
|
chainsyncer.cli
|
||||||
chainsyncer.runnable
|
chainsyncer.runnable
|
||||||
|
chainsyncer.data
|
||||||
|
|
||||||
#[options.package_data]
|
#[options.package_data]
|
||||||
#* =
|
#* =
|
||||||
|
Loading…
Reference in New Issue
Block a user