Update cli module for chainlib 0.3.0, fix remaining settings processing
This commit is contained in:
parent
c45e6e3310
commit
c5bd4aad3a
@ -1,11 +0,0 @@
|
|||||||
# 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')
|
|
@ -1,4 +1,8 @@
|
|||||||
def process_flags(argparser, flags):
|
def apply_flag(flag):
|
||||||
argparser.add_argument('--backend', type=str, help='Backend to use for state store')
|
flag.add('queue')
|
||||||
argparser.add_argument('--tx-digest-size', dest='tx_digest_size', type=str, help='Size of transaction hash in bytes')
|
return flag
|
||||||
argparser.add_argument('--state-dir', dest='state_dir', type=str, help='Directory to store queuer state in')
|
|
||||||
|
|
||||||
|
def apply_arg(arg):
|
||||||
|
arg.add_long('tx-digest-size', 'queue', type=int, help='Size of transaction hash in bytes')
|
||||||
|
return arg
|
||||||
|
@ -15,19 +15,14 @@ def process_queue_tx(settings, config):
|
|||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
|
||||||
def process_queue_backend(settings, config):
|
|
||||||
settings.set('QUEUE_BACKEND', config.get('QUEUE_BACKEND'))
|
|
||||||
return settings
|
|
||||||
|
|
||||||
|
|
||||||
def process_queue_store(settings, config):
|
def process_queue_store(settings, config):
|
||||||
status = Status(settings.o['QUEUE_STORE_FACTORY'], allow_invalid=True)
|
status = Status(settings.get('QUEUE_STORE_FACTORY'), allow_invalid=True)
|
||||||
settings.set('QUEUE_STATE_STORE'], status)
|
settings.set('QUEUE_STATE_STORE', status)
|
||||||
store = Store(
|
store = Store(
|
||||||
settings.o['CHAIN_SPEC'],
|
settings.get('CHAIN_SPEC'),
|
||||||
settings.o['QUEUE_STATE_STORE'],
|
settings.get('QUEUE_STATE_STORE'),
|
||||||
settings.o['QUEUE_INDEX_STORE'],
|
settings.get('QUEUE_INDEX_STORE'),
|
||||||
settings.o['QUEUE_COUNTER_STORE'],
|
settings.get('QUEUE_COUNTER_STORE'),
|
||||||
sync=True,
|
sync=True,
|
||||||
)
|
)
|
||||||
settings.set('QUEUE_STORE', store)
|
settings.set('QUEUE_STORE', store)
|
||||||
@ -37,15 +32,15 @@ def process_queue_store(settings, config):
|
|||||||
def process_queue_paths(settings, config):
|
def process_queue_paths(settings, config):
|
||||||
index_dir = config.get('QUEUE_INDEX_PATH')
|
index_dir = config.get('QUEUE_INDEX_PATH')
|
||||||
if index_dir == None:
|
if index_dir == None:
|
||||||
index_dir = os.path.join(config.get('QUEUE_STATE_PATH'), 'tx')
|
index_dir = os.path.join(config.get('STATE_PATH'), 'tx')
|
||||||
|
|
||||||
counter_dir = config.get('QUEUE_COUNTER_PATH')
|
counter_dir = config.get('QUEUE_COUNTER_PATH')
|
||||||
if counter_dir == None:
|
if counter_dir == None:
|
||||||
counter_dir = os.path.join(config.get('QUEUE_STATE_PATH'))
|
counter_dir = os.path.join(config.get('STATE_PATH'))
|
||||||
|
|
||||||
settings.set('QUEUE_STATE_PATH', config.get('QUEUE_STATE_PATH'))
|
settings.set('QUEUE_STATE_PATH', config.get('STATE_PATH'))
|
||||||
settings.set('QUEUE_INDEX_PATH', index_dir)
|
settings.set('QUEUE_INDEX_PATH', index_dir)
|
||||||
settings.set('QUEUE_COUNTER_PATH'], counter_dir)
|
settings.set('QUEUE_COUNTER_PATH', counter_dir)
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user