Compare commits
6 Commits
dev-0.2.9
...
dev-0.2.12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a5818ebf1
|
||
|
|
5d2d73fa64
|
||
|
|
dd1879bb91
|
||
|
|
e264ed5c37
|
||
|
|
d472bd4f7c
|
||
|
|
465d692956
|
@@ -1,3 +1,10 @@
|
|||||||
|
- 0.2.12
|
||||||
|
* Breaking upgrade of chainlib.
|
||||||
|
* Implement generic block and tx.
|
||||||
|
- 0.2.11
|
||||||
|
* Upgrade shep to handle exception in filestore list
|
||||||
|
- 0.2.10
|
||||||
|
* Upgrade shep to guarantee state lock atomicity
|
||||||
- 0.2.9
|
- 0.2.9
|
||||||
* Minimize instantiations of adapters in filter execution
|
* Minimize instantiations of adapters in filter execution
|
||||||
- 0.2.8
|
- 0.2.8
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ class StateFilter(SyncFilter):
|
|||||||
break
|
break
|
||||||
except NotLocalTxError:
|
except NotLocalTxError:
|
||||||
logg.debug('skipping not local transaction {}'.format(tx.hash))
|
logg.debug('skipping not local transaction {}'.format(tx.hash))
|
||||||
self.__stop_adapter()
|
|
||||||
return False
|
return False
|
||||||
except BackendError as e:
|
except BackendError as e:
|
||||||
logg.error('adapter get failed: {}, one more try'.format(e))
|
logg.error('adapter get failed: {}, one more try'.format(e))
|
||||||
@@ -116,7 +115,7 @@ class StateFilter(SyncFilter):
|
|||||||
queue_adapter = self.__get_adapter(block, force_reload=True)
|
queue_adapter = self.__get_adapter(block, force_reload=True)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logg.info('filter registered {} for {} in {}'.format(tx.status.name, tx.hash, block))
|
logg.info('filter registered {} for {} in {}'.format(tx.status_name, tx.hash, block))
|
||||||
|
|
||||||
if self.throttler != None:
|
if self.throttler != None:
|
||||||
self.throttler.dec(tx.hash)
|
self.throttler.dec(tx.hash)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import os
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
|
from chainlib.settings import ChainSettings
|
||||||
from chainsyncer.settings import ChainsyncerSettings
|
from chainsyncer.settings import ChainsyncerSettings
|
||||||
from chainqueue.settings import ChainqueueSettings
|
from chainqueue.settings import ChainqueueSettings
|
||||||
|
|
||||||
@@ -106,18 +107,39 @@ class ChaindSettings(ChainsyncerSettings, ChainqueueSettings):
|
|||||||
raise ValueError('at least one backend must be set')
|
raise ValueError('at least one backend must be set')
|
||||||
|
|
||||||
|
|
||||||
|
def process_chaind_queue(self, config):
|
||||||
|
if config.get('QUEUE_STATE_PATH') == None:
|
||||||
|
queue_state_dir = self.dir_for('queue')
|
||||||
|
config.add(queue_state_dir, 'QUEUE_STATE_PATH', False)
|
||||||
|
logg.debug('setting queue state path {}'.format(queue_state_dir))
|
||||||
|
|
||||||
|
self.process_queue_tx(config)
|
||||||
|
self.process_queue_paths(config)
|
||||||
|
if config.get('QUEUE_BACKEND') == 'fs':
|
||||||
|
self.process_queue_backend_fs(config)
|
||||||
|
self.process_queue_backend(config)
|
||||||
|
self.process_queue_store(config)
|
||||||
|
|
||||||
|
|
||||||
def process(self, config):
|
def process(self, config):
|
||||||
super(ChaindSettings, self).process(config)
|
#super(ChaindSettings, self).process(config)
|
||||||
if self.include_sync:
|
self.process_common(config)
|
||||||
self.process_sync(config)
|
|
||||||
self.process_sync_backend(config)
|
|
||||||
if self.include_queue:
|
if self.include_queue:
|
||||||
self.process_queue_backend(config)
|
self.process_queue_backend(config)
|
||||||
self.process_dispatch(config)
|
if self.include_sync:
|
||||||
self.process_token(config)
|
self.process_sync_backend(config)
|
||||||
|
|
||||||
self.process_backend(config)
|
self.process_backend(config)
|
||||||
self.process_session(config)
|
self.process_session(config)
|
||||||
|
|
||||||
|
if self.include_sync:
|
||||||
|
self.process_sync(config)
|
||||||
|
if self.include_queue:
|
||||||
|
self.process_chaind_queue(config)
|
||||||
|
self.process_dispatch(config)
|
||||||
|
self.process_token(config)
|
||||||
|
|
||||||
self.process_socket(config)
|
self.process_socket(config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ from chainqueue.cache import CacheTokenTx
|
|||||||
from chainlib.status import Status as TxStatus
|
from chainlib.status import Status as TxStatus
|
||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
from chainlib.error import RPCException
|
from chainlib.error import RPCException
|
||||||
|
from chainlib.tx import (
|
||||||
|
Tx,
|
||||||
|
TxResult,
|
||||||
|
)
|
||||||
|
from chainlib.block import Block
|
||||||
|
|
||||||
|
|
||||||
class MockCacheAdapter(CacheTokenTx):
|
class MockCacheAdapter(CacheTokenTx):
|
||||||
@@ -34,8 +39,17 @@ class MockDispatcher:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MockTx:
|
class MockTx(Tx):
|
||||||
|
|
||||||
def __init__(self, tx_hash, status=TxStatus.SUCCESS):
|
def __init__(self, tx_hash, status=TxStatus.SUCCESS):
|
||||||
self.hash = tx_hash
|
result = TxResult()
|
||||||
self.status = status
|
result.status = status
|
||||||
|
super(MockTx, self).__init__(result=result)
|
||||||
|
self.set_hash(tx_hash)
|
||||||
|
|
||||||
|
|
||||||
|
class MockBlock(Block):
|
||||||
|
|
||||||
|
def __init__(self, number):
|
||||||
|
super(MockBlock, self).__init__()
|
||||||
|
self.number = number
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
chainlib~=0.1.2
|
chainlib~=0.2.0
|
||||||
chainqueue~=0.1.12
|
chainqueue~=0.1.16
|
||||||
chainsyncer~=0.4.4
|
chainsyncer~=0.4.9
|
||||||
confini~=0.6.0
|
confini~=0.6.0
|
||||||
funga~=0.5.2
|
funga~=0.5.2
|
||||||
pyxdg~=0.26
|
pyxdg~=0.26
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chaind
|
name = chaind
|
||||||
version = 0.2.9
|
version = 0.2.12
|
||||||
description = Base package for chain queue service
|
description = Base package for chain queue service
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from chaind.filter import StateFilter
|
|||||||
# test imports
|
# test imports
|
||||||
from chaind.unittest.common import (
|
from chaind.unittest.common import (
|
||||||
MockTx,
|
MockTx,
|
||||||
|
MockBlock,
|
||||||
MockCacheAdapter,
|
MockCacheAdapter,
|
||||||
MockDispatcher,
|
MockDispatcher,
|
||||||
)
|
)
|
||||||
@@ -76,7 +77,8 @@ class TestChaindFs(TestChaindFsBase):
|
|||||||
|
|
||||||
fltr = StateFilter(self.chain_spec, self.path, MockCacheAdapter)
|
fltr = StateFilter(self.chain_spec, self.path, MockCacheAdapter)
|
||||||
tx = MockTx(hsh)
|
tx = MockTx(hsh)
|
||||||
fltr.filter(None, None, tx)
|
block = MockBlock(42)
|
||||||
|
fltr.filter(None, block, tx)
|
||||||
|
|
||||||
|
|
||||||
def test_fs_filter_fail(self):
|
def test_fs_filter_fail(self):
|
||||||
@@ -87,7 +89,8 @@ class TestChaindFs(TestChaindFsBase):
|
|||||||
|
|
||||||
fltr = StateFilter(self.chain_spec, self.path, MockCacheAdapter)
|
fltr = StateFilter(self.chain_spec, self.path, MockCacheAdapter)
|
||||||
tx = MockTx(hsh, TxStatus.ERROR)
|
tx = MockTx(hsh, TxStatus.ERROR)
|
||||||
fltr.filter(None, None, tx)
|
block = MockBlock(42)
|
||||||
|
fltr.filter(None, block, tx)
|
||||||
|
|
||||||
|
|
||||||
def test_upcoming(self):
|
def test_upcoming(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user