Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b63793fd9b
|
||
|
|
84b8eb10e6
|
||
|
|
532ff230b4
|
||
|
|
f7c09acfe2
|
@@ -1,3 +1,12 @@
|
|||||||
|
- 0.1.6
|
||||||
|
* Sort upcoming queue item chronologically
|
||||||
|
* Add unit testing for upcoming query method
|
||||||
|
- 0.1.5
|
||||||
|
* Add reserved state check method
|
||||||
|
- 0.1.4
|
||||||
|
* Dependency cleanups
|
||||||
|
- 0.1.3
|
||||||
|
* Add CLI args and config handling, settings object
|
||||||
- 0.1.2
|
- 0.1.2
|
||||||
* Add CLI inspection tools
|
* Add CLI inspection tools
|
||||||
- 0.1.1
|
- 0.1.1
|
||||||
|
|||||||
@@ -24,12 +24,6 @@ class CacheIntegrityError(ChainQueueException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BackendIntegrityError(ChainQueueException):
|
|
||||||
"""Raised when queue backend has invalid state
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class DuplicateTxError(ChainQueueException):
|
class DuplicateTxError(ChainQueueException):
|
||||||
"""Backend already knows transaction
|
"""Backend already knows transaction
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from chainqueue.cache import CacheTx
|
from chainqueue.cache import CacheTx
|
||||||
from chainqueue.entry import QueueEntry
|
from chainqueue.entry import QueueEntry
|
||||||
from chainqueue.error import (
|
from chainqueue.error import NotLocalTxError
|
||||||
NotLocalTxError,
|
|
||||||
BackendIntegrityError,
|
|
||||||
)
|
|
||||||
from chainqueue.enum import (
|
from chainqueue.enum import (
|
||||||
StatusBits,
|
StatusBits,
|
||||||
all_errors,
|
all_errors,
|
||||||
@@ -49,19 +47,18 @@ 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))
|
||||||
|
|
||||||
sync_err = None
|
sync_err = None
|
||||||
for i in range(2):
|
try:
|
||||||
try:
|
self.state_store.sync()
|
||||||
self.state_store.sync()
|
except Exception as e:
|
||||||
except Exception as e:
|
sync_err = e
|
||||||
sync_err = e
|
|
||||||
continue
|
|
||||||
|
|
||||||
if sync_err != None:
|
if sync_err != None:
|
||||||
raise BackendIntegrityError(sync_err)
|
raise FileNotFoundError(sync_err)
|
||||||
|
|
||||||
|
|
||||||
def put(self, v, cache_adapter=CacheTx):
|
def put(self, v, cache_adapter=CacheTx):
|
||||||
@@ -80,16 +77,15 @@ class Store:
|
|||||||
|
|
||||||
def get(self, k):
|
def get(self, k):
|
||||||
v = None
|
v = None
|
||||||
for i in range(2):
|
s = self.index_store.get(k)
|
||||||
s = self.index_store.get(k)
|
err = None
|
||||||
try:
|
try:
|
||||||
self.state_store.sync()
|
self.state_store.sync()
|
||||||
v = self.state_store.get(s)
|
v = self.state_store.get(s)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError as e:
|
||||||
continue
|
err = e
|
||||||
break
|
|
||||||
if v == None:
|
if v == None:
|
||||||
raise NotLocalTxError(k)
|
raise NotLocalTxError('could not find tx {}: {}'.format(k, err))
|
||||||
return (s, v,)
|
return (s, v,)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.6
|
version = 0.1.9
|
||||||
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