Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c360ca2e5
|
||
|
|
ff74679de8
|
||
|
|
94bd5c8cdf
|
||
|
|
ccbbcc2157
|
11
chainqueue/cli/__init__.py
Normal file
11
chainqueue/cli/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# standard imports
|
||||
import os
|
||||
|
||||
# local imports
|
||||
from .arg import process_flags
|
||||
from .config import process_config
|
||||
|
||||
|
||||
__script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
data_dir = os.path.join(os.path.dirname(__script_dir), 'data')
|
||||
config_dir = os.path.join(data_dir, 'config')
|
||||
2
chainqueue/cli/arg.py
Normal file
2
chainqueue/cli/arg.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def process_flags(argparser, flags):
|
||||
argparser.add_argument('--backend', type=str, help='Backend to use for state store')
|
||||
8
chainqueue/cli/config.py
Normal file
8
chainqueue/cli/config.py
Normal file
@@ -0,0 +1,8 @@
|
||||
def process_config(config, args, flags):
|
||||
args_override = {}
|
||||
|
||||
args_override['QUEUE_BACKEND'] = getattr(args, 'backend')
|
||||
|
||||
config.dict_override(args_override, 'local cli args')
|
||||
|
||||
return config
|
||||
@@ -1,9 +1,2 @@
|
||||
[database]
|
||||
name =
|
||||
engine =
|
||||
driver =
|
||||
host =
|
||||
port =
|
||||
user =
|
||||
password =
|
||||
debug = 0
|
||||
[queue]
|
||||
backend = mem
|
||||
|
||||
@@ -134,6 +134,10 @@ class QueueEntry:
|
||||
self.store.cache.set_block(self.tx_hash, block, tx)
|
||||
|
||||
|
||||
def test(self, state):
|
||||
return self.__match_state(state)
|
||||
|
||||
|
||||
def __str__(self):
|
||||
v = self.store.get(self.tx_hash)
|
||||
n = self.store.state(v[0])
|
||||
|
||||
8
chainqueue/settings.py
Normal file
8
chainqueue/settings.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# external imports
|
||||
from chainlib.settings import ChainSettings
|
||||
|
||||
|
||||
class ChainqueueSettings(ChainSettings):
|
||||
|
||||
def process_queue_backend(self, config):
|
||||
self.o['QUEUE_BACKEND'] = config.get('QUEUE_BACKEND')
|
||||
@@ -67,6 +67,7 @@ class Store:
|
||||
s = self.index_store.get(k)
|
||||
except FileNotFoundError:
|
||||
raise NotLocalTxError(k)
|
||||
self.state_store.sync()
|
||||
v = self.state_store.get(s)
|
||||
return (s, v,)
|
||||
|
||||
@@ -152,3 +153,9 @@ class Store:
|
||||
entry = QueueEntry(self, k)
|
||||
entry.load()
|
||||
entry.sent()
|
||||
|
||||
|
||||
def is_reserved(self, k):
|
||||
entry = QueueEntry(self, k)
|
||||
entry.load()
|
||||
return entry.test(self.RESERVED)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
pysha3==1.0.2
|
||||
#pysha3==1.0.2
|
||||
hexathon~=0.1.5
|
||||
leveldir~=0.3.0
|
||||
alembic==1.4.2
|
||||
SQLAlchemy==1.3.20
|
||||
#alembic==1.4.2
|
||||
#SQLAlchemy==1.3.20
|
||||
confini~=0.6.0
|
||||
pyxdg~=0.27
|
||||
chainlib>=0.1.0b1,<=0.1.0
|
||||
shep>=0.1.1rc1,<=0.3.0
|
||||
#pyxdg~=0.27
|
||||
chainlib~=0.1.1
|
||||
shep~=0.2.3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = chainqueue
|
||||
version = 0.1.2
|
||||
version = 0.1.5
|
||||
description = Generic blockchain transaction queue control
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
@@ -25,7 +25,7 @@ licence_files =
|
||||
LICENSE.txt
|
||||
|
||||
[options]
|
||||
python_requires = >= 3.6
|
||||
python_requires = >= 3.7
|
||||
include_package_data = True
|
||||
packages =
|
||||
chainqueue
|
||||
@@ -33,6 +33,7 @@ packages =
|
||||
chainqueue.unittest
|
||||
chainqueue.store
|
||||
chainqueue.runnable
|
||||
chainqueue.cli
|
||||
|
||||
#[options.entry_points]
|
||||
#console_scripts =
|
||||
|
||||
Reference in New Issue
Block a user