mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
added to schema all execute commands in dictionary format
This commit is contained in:
parent
3d089fe904
commit
5723e24498
@ -6,6 +6,126 @@ from planetmint.backend.tarantool.connection import TarantoolDB
|
||||
|
||||
register_schema = module_dispatch_registrar(backend.schema)
|
||||
|
||||
SPACE_NAMES = ("abci_chains", "assets", "blocks", "blocks_tx",
|
||||
"elections", "meta_data", "pre_commits", "validators",
|
||||
"transactions", "inputs", "outputs", "keys")
|
||||
|
||||
SPACE_COMMANDS = {
|
||||
"abci_chains": "abci_chains = box.schema.space.create('abci_chains', {engine='memtx', is_sync = false})",
|
||||
"assets": "assets = box.schema.space.create('assets' , {engine='memtx' , is_sync=false})",
|
||||
"blocks": "blocks = box.schema.space.create('blocks' , {engine='memtx' , is_sync=false})",
|
||||
"blocks_tx": "blocks_tx = box.schema.space.create('blocks_tx')",
|
||||
"elections": "elections = box.schema.space.create('elections',{engine = 'memtx' , is_sync = false})",
|
||||
"meta_data": "meta_datas = box.schema.space.create('meta_data',{engine = 'memtx' , is_sync = false})",
|
||||
"pre_commits": "pre_commits = box.schema.space.create('pre_commits' , {engine='memtx' , is_sync=false})",
|
||||
"validators": "validators = box.schema.space.create('validators' , {engine = 'memtx' , is_sync = false})",
|
||||
"transactions": "transactions = box.schema.space.create('transactions',{engine='memtx' , is_sync=false})",
|
||||
"inputs": "inputs = box.schema.space.create('inputs')",
|
||||
"outputs": "outputs = box.schema.space.create('outputs')",
|
||||
"keys": "keys = box.schema.space.create('keys')",
|
||||
"utxos": "utxos = box.schema.space.create('utxos', {engine = 'memtx' , is_sync = false})"
|
||||
}
|
||||
|
||||
INDEX_COMMANDS = {
|
||||
"abci_chains":
|
||||
{
|
||||
"id_search": "abci_chains:create_index('id_search' ,{type='hash', parts={'chain_id'}})",
|
||||
"height_search": "abci_chains:create_index('height_search' ,{type='tree',unique=false, parts={'height'}})"
|
||||
},
|
||||
"assets":
|
||||
{
|
||||
"txid_search": "assets:create_index('txid_search', {type='hash', parts={'tx_id'}})",
|
||||
"assetid_search": "assets:create_index('assetid_search', {type='tree',unique=false, parts={'asset_id', 'tx_id'}})",
|
||||
"only_asset_search": "assets:create_index('only_asset_search', {type='tree', unique=false, parts={'asset_id'}})"
|
||||
},
|
||||
"blocks":
|
||||
{
|
||||
"id_search": "blocks:create_index('id_search' , {type='hash' , parts={'block_id'}})",
|
||||
"block_search": "blocks:create_index('block_search' , {type='tree', unique = false, parts={'height'}})",
|
||||
"block_id_search": "blocks:create_index('block_id_search', {type = 'hash', parts ={'block_id'}})"
|
||||
},
|
||||
"blocks_tx":
|
||||
{
|
||||
"id_search": "blocks_tx:create_index('id_search',{ type = 'hash', parts={'transaction_id'}})",
|
||||
"block_search": "blocks_tx:create_index('block_search', {type = 'tree',unique=false, parts={'block_id'}})"
|
||||
},
|
||||
"elections":
|
||||
{
|
||||
"id_search": "elections:create_index('id_search' , {type='hash', parts={'election_id'}})",
|
||||
"height_search": "elections:create_index('height_search' , {type='tree',unique=false, parts={'height'}})",
|
||||
"update_search": "elections:create_index('update_search', {type='tree', unique=false, parts={'election_id', 'height'}})"
|
||||
},
|
||||
"meta_data":
|
||||
{
|
||||
"id_search": "meta_datas:create_index('id_search', { type='hash' , parts={'transaction_id'}})"
|
||||
},
|
||||
"pre_commits":
|
||||
{
|
||||
"id_search": "pre_commits:create_index('id_search', {type ='hash' , parts={'commit_id'}})",
|
||||
"height_search": "pre_commits:create_index('height_search', {type ='tree',unique=true, parts={'height'}})"
|
||||
},
|
||||
"validators":
|
||||
{
|
||||
"id_search": "validators:create_index('id_search' , {type='hash' , parts={'validator_id'}})",
|
||||
"height_search": "validators:create_index('height_search' , {type='tree', unique=true, parts={'height'}})"
|
||||
},
|
||||
"transactions":
|
||||
{
|
||||
"id_search": "transactions:create_index('id_search' , {type = 'hash' , parts={'transaction_id'}})",
|
||||
"transaction_search": "transactions:create_index('transaction_search' , {type = 'tree',unique=false, parts={'operation', 'transaction_id'}})"
|
||||
},
|
||||
"inputs":
|
||||
{
|
||||
"delete_search": "inputs:create_index('delete_search' , {type = 'hash', parts={'input_id'}})",
|
||||
"spent_search": "inputs:create_index('spent_search' , {type = 'tree', unique=false, parts={'fulfills_transaction_id', 'fulfills_output_index'}})",
|
||||
"id_search": "inputs:create_index('id_search', {type = 'tree', unique=false, parts = {'transaction_id'}})"
|
||||
},
|
||||
"outputs":
|
||||
{
|
||||
"unique_search": "outputs:create_index('unique_search' ,{type='hash', parts={'output_id'}})",
|
||||
"id_search": "outputs:create_index('id_search' ,{type='tree', unique=false, parts={'transaction_id'}})"
|
||||
},
|
||||
"keys":
|
||||
{
|
||||
"id_search": "keys:create_index('id_search', {type = 'hash', parts={'id'}})",
|
||||
"keys_search": "keys:create_index('keys_search', {type = 'tree', unique=false, parts={'public_key'}})",
|
||||
"txid_search": "keys:create_index('txid_search', {type = 'tree', unique=false, parts={'transaction_id'}})",
|
||||
"output_search": "keys:create_index('output_search', {type = 'tree', unique=false, parts={'output_id'}})"
|
||||
},
|
||||
"utxos":
|
||||
{
|
||||
"id_search": "utxos:create_index('id_search', {type='hash' , parts={'transaction_id', 'output_index'}})",
|
||||
"transaction_search": "utxos:create_index('transaction_search', {type='tree', unique=false, parts={'transaction_id'}})",
|
||||
"index_Search": "utxos:create_index('index_search', {type='tree', unique=false, parts={'output_index'}})"
|
||||
}
|
||||
}
|
||||
|
||||
SCHEMA_COMMANDS = {
|
||||
"abci_chains":
|
||||
"abci_chains:format({{name='height' , type='integer'},{name='is_synched' , type='boolean'},{name='chain_id',type='string'}})",
|
||||
"assets":
|
||||
"assets:format({{name='data' , type='any'}, {name='tx_id', type='string'}, {name='asset_id', type='string'}})",
|
||||
"blocks":
|
||||
"blocks:format{{name='app_hash',type='string'},{name='height' , type='integer'},{name='block_id' , type='string'}}",
|
||||
"blocks_tx": "blocks_tx:format{{name='transaction_id', type = 'string'}, {name = 'block_id', type = 'string'}}",
|
||||
"elections":
|
||||
"elections:format({{name='election_id' , type='string'},{name='height' , type='integer'}, {name='is_concluded' , type='boolean'}})",
|
||||
"meta_data": "meta_datas:format({{name='transaction_id' , type='string'}, {name='meta_data' , type='any'}})",
|
||||
"pre_commits":
|
||||
"pre_commits:format({{name='commit_id', type='string'}, {name='height',type='integer'}, {name='transactions',type=any}})",
|
||||
"validators":
|
||||
"validators:format({{name='validator_id' , type='string'},{name='height',type='integer'},{name='validators' , type='any'}})",
|
||||
"transactions":
|
||||
"transactions:format({{name='transaction_id' , type='string'}, {name='operation' , type='string'}, {name='version' ,type='string'}, {name='dict_map', type='any'}})",
|
||||
"inputs":
|
||||
"inputs:format({{name='transaction_id' , type='string'}, {name='fulfillment' , type='any'}, {name='owners_before' , type='array'}, {name='fulfills_transaction_id', type = 'string'}, {name='fulfills_output_index', type = 'string'}, {name='input_id', type='string'}, {name='input_index', type='number'}})",
|
||||
"outputs":
|
||||
"outputs:format({{name='transaction_id' , type='string'}, {name='amount' , type='string'}, {name='uri', type='string'}, {name='details_type', type='string'}, {name='details_public_key', type='any'}, {name = 'output_id', type = 'string'}, {name='treshold', type='any'}, {name='subconditions', type='any'}, {name='output_index', type='number'}})",
|
||||
"keys":
|
||||
"keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}, {name = 'key_index', type = 'integer'}})",
|
||||
"utxos":
|
||||
"utxos:format({{name='transaction_id' , type='string'}, {name='output_index' , type='integer'}, {name='utxo_dict', type='string'}})"
|
||||
}
|
||||
|
||||
@register_schema(TarantoolDB)
|
||||
def drop_database(connection, not_used=None):
|
||||
|
||||
52
rem_req.txt
52
rem_req.txt
@ -1,52 +0,0 @@
|
||||
abci==0.8.3
|
||||
aiohttp==3.8.1
|
||||
aiosignal==1.2.0
|
||||
aniso8601==9.0.1
|
||||
async-timeout==4.0.2
|
||||
attrs==21.4.0
|
||||
base58==2.1.0
|
||||
capturer==3.0
|
||||
certifi==2022.5.18.1
|
||||
cffi==1.15.0
|
||||
chardet==3.0.4
|
||||
charset-normalizer==2.0.12
|
||||
click==8.1.3
|
||||
colorlog==6.6.0
|
||||
cryptography==3.4.7
|
||||
Flask==2.1.2
|
||||
Flask-Cors==3.0.10
|
||||
Flask-RESTful==0.3.9
|
||||
frozenlist==1.3.0
|
||||
gunicorn==20.1.0
|
||||
humanfriendly==10.0
|
||||
idna==2.10
|
||||
importlib-metadata==4.11.4
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
jsonschema==3.2.0
|
||||
logstats==0.3.0
|
||||
MarkupSafe==2.1.1
|
||||
msgpack==1.0.3
|
||||
multidict==6.0.2
|
||||
packaging==21.3
|
||||
Planetmint==0.9.2
|
||||
planetmint-cryptoconditions==0.9.5
|
||||
protobuf==4.21.0rc2
|
||||
pyasn1==0.4.8
|
||||
pycparser==2.21
|
||||
pymongo==3.11.4
|
||||
PyNaCl==1.4.0
|
||||
pyparsing==3.0.9
|
||||
pyrsistent==0.18.1
|
||||
python-rapidjson==1.0
|
||||
pytz==2022.1
|
||||
PyYAML==5.4.1
|
||||
requests==2.25.1
|
||||
setproctitle==1.2.2
|
||||
six==1.16.0
|
||||
tarantool==0.7.1
|
||||
urllib3==1.26.9
|
||||
Werkzeug==2.0.3
|
||||
yarl==1.7.2
|
||||
zenroom==2.0.0.dev1644927841
|
||||
zipp==3.8.0
|
||||
Loading…
x
Reference in New Issue
Block a user