Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a8ec01588
|
||
|
|
b63793fd9b
|
||
|
|
84b8eb10e6
|
@@ -29,7 +29,7 @@ all_local_errors = all_errors() - StatusBits.NETWORK_ERROR
|
|||||||
re_u = r'^[^_][_A-Z]+$'
|
re_u = r'^[^_][_A-Z]+$'
|
||||||
class Store:
|
class Store:
|
||||||
|
|
||||||
def __init__(self, chain_spec, state_store, index_store, counter, cache=None):
|
def __init__(self, chain_spec, state_store, index_store, counter, cache=None, sync=True):
|
||||||
self.chain_spec = chain_spec
|
self.chain_spec = chain_spec
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
self.state_store = state_store
|
self.state_store = state_store
|
||||||
@@ -47,9 +47,13 @@ class Store:
|
|||||||
'unset',
|
'unset',
|
||||||
'name',
|
'name',
|
||||||
'modified',
|
'modified',
|
||||||
|
'purge',
|
||||||
]:
|
]:
|
||||||
setattr(self, v, getattr(self.state_store, v))
|
setattr(self, v, getattr(self.state_store, v))
|
||||||
|
|
||||||
|
if not sync:
|
||||||
|
return
|
||||||
|
|
||||||
sync_err = None
|
sync_err = None
|
||||||
try:
|
try:
|
||||||
self.state_store.sync()
|
self.state_store.sync()
|
||||||
@@ -105,10 +109,12 @@ class Store:
|
|||||||
if item_state & state != item_state:
|
if item_state & state != item_state:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logg.info('state {} {}'.format(ref, item_state))
|
|
||||||
if item_state & not_state > 0:
|
if item_state & not_state > 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
item_state_str = self.state_store.name(item_state)
|
||||||
|
logg.info('state {} {} ({})'.format(ref, item_state_str, item_state))
|
||||||
|
|
||||||
if threshold != None:
|
if threshold != None:
|
||||||
v = self.state_store.modified(ref)
|
v = self.state_store.modified(ref)
|
||||||
if v > threshold:
|
if v > threshold:
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class CounterStore:
|
|||||||
|
|
||||||
v = f.read(8)
|
v = f.read(8)
|
||||||
self.count = int.from_bytes(v, byteorder='big')
|
self.count = int.from_bytes(v, byteorder='big')
|
||||||
logg.info('counter starts at {}'.format(self.count))
|
logg.debug('counter starts at {}'.format(self.count))
|
||||||
|
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ leveldir~=0.3.0
|
|||||||
confini~=0.6.0
|
confini~=0.6.0
|
||||||
#pyxdg~=0.27
|
#pyxdg~=0.27
|
||||||
chainlib~=0.1.1
|
chainlib~=0.1.1
|
||||||
shep~=0.2.3
|
shep~=0.2.5
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainqueue
|
name = chainqueue
|
||||||
version = 0.1.7
|
version = 0.1.10
|
||||||
description = Generic blockchain transaction queue control
|
description = Generic blockchain transaction queue control
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
|||||||
Reference in New Issue
Block a user