mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
changed to port 3303 and added working drop and init scripts
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
193fe1cba0
commit
e66301a38a
@ -1,23 +0,0 @@
|
||||
box.space.abci_chains:drop()
|
||||
|
||||
box.space.assets:drop()
|
||||
|
||||
box.space.blocks:drop()
|
||||
|
||||
box.space.blocks_tx:drop()
|
||||
|
||||
box.space.elections:drop()
|
||||
|
||||
box.space.meta_datas:drop()
|
||||
|
||||
box.space.pre_commits:drop()
|
||||
|
||||
box.space.validators:drop()
|
||||
|
||||
box.space.transactions:drop()
|
||||
|
||||
box.space.inputs:drop()
|
||||
|
||||
box.space.outputs:drop()
|
||||
|
||||
box.space.keys:drop()
|
||||
@ -1,69 +0,0 @@
|
||||
abci_chains = box.schema.space.create('abci_chains',{engine = 'memtx' , is_sync = false})
|
||||
abci_chains:format({{name='height' , type='integer'},{name='is_synched' , type='boolean'},{name='chain_id',type='string'}})
|
||||
abci_chains:create_index('id_search' ,{type='hash', parts={'chain_id'}})
|
||||
abci_chains:create_index('height_search' ,{type='tree',unique=false, parts={'height'}})
|
||||
|
||||
assets = box.schema.space.create('assets' , {engine='memtx' , is_sync=false})
|
||||
assets:format({{name='asset_id', type='string'}, {name='data' , type='any'}, {name='tx_id', type='string'}})
|
||||
assets:create_index('assetid_search', {type='hash', parts={'asset_id'}})
|
||||
assets:create_index('txid_search', {type='hash', parts={'tx_id'}})
|
||||
|
||||
blocks = box.schema.space.create('blocks' , {engine='memtx' , is_sync=false})
|
||||
blocks:format{{name='app_hash',type='string'},{name='height' , type='integer'},{name='block_id' , type='string'}}
|
||||
blocks:create_index('id_search' , {type='hash' , parts={'block_id'}})
|
||||
blocks:create_index('block_search' , {type='tree', unique = false, parts={'height'}})
|
||||
blocks:create_index('block_id_search', {type = 'hash', parts ={'block_id'}})
|
||||
|
||||
blocks_tx = box.schema.space.create('blocks_tx')
|
||||
blocks_tx:format{{name='transaction_id', type = 'string'}, {name = 'block_id', type = 'string'}}
|
||||
blocks_tx:create_index('id_search',{ type = 'hash', parts={'transaction_id'}})
|
||||
blocks_tx:create_index('block_search', {type = 'tree',unique=false, parts={'block_id'}})
|
||||
|
||||
elections = box.schema.space.create('elections',{engine = 'memtx' , is_sync = false})
|
||||
elections:format({{name='election_id' , type='string'},{name='height' , type='integer'}, {name='is_concluded' , type='boolean'}})
|
||||
elections:create_index('id_search' , {type='hash', parts={'election_id'}})
|
||||
elections:create_index('height_search' , {type='tree',unique=false, parts={'height'}})
|
||||
elections:create_index('update_search', {type='tree', unique=false, parts={'election_id', 'height'}})
|
||||
|
||||
meta_datas = box.schema.space.create('meta_data',{engine = 'memtx' , is_sync = false})
|
||||
meta_datas:format({{name='transaction_id' , type='string'}, {name='meta_data' , type='any'}})
|
||||
meta_datas:create_index('id_search', { type='hash' , parts={'transaction_id'}})
|
||||
|
||||
pre_commits = box.schema.space.create('pre_commits' , {engine='memtx' , is_sync=false})
|
||||
pre_commits:format({{name='commit_id', type='string'}, {name='height',type='integer'}, {name='transactions',type=any}})
|
||||
pre_commits:create_index('id_search', {type ='hash' , parts={'commit_id'}})
|
||||
pre_commits:create_index('height_search', {type ='tree',unique=true, parts={'height'}})
|
||||
|
||||
validators = box.schema.space.create('validators' , {engine = 'memtx' , is_sync = false})
|
||||
validators:format({{name='validator_id' , type='string'},{name='height',type='integer'},{name='validators' , type='any'}})
|
||||
validators:create_index('id_search' , {type='hash' , parts={'validator_id'}})
|
||||
validators:create_index('height_search' , {type='tree', unique=true, parts={'height'}})
|
||||
|
||||
transactions = box.schema.space.create('transactions',{engine='memtx' , is_sync=false})
|
||||
transactions:format({{name='transaction_id' , type='string'}, {name='operation' , type='string'}, {name='version' ,type='string'}, {name='asset_id', type='string'}, {name='dict_map', type='any'}})
|
||||
transactions:create_index('id_search' , {type = 'hash' , parts={'transaction_id'}})
|
||||
transactions:create_index('only_asset_search', {type = 'tree', unique=false, parts={'asset_id'}})
|
||||
transactions:create_index('asset_search' , {type = 'tree',unique=false, parts={'operation', 'asset_id'}})
|
||||
transactions:create_index('transaction_search' , {type = 'tree',unique=false, parts={'operation', 'transaction_id'}})
|
||||
transactions:create_index('both_search' , {type = 'tree',unique=false, parts={'asset_id', 'transaction_id'}})
|
||||
|
||||
inputs = box.schema.space.create('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'}})
|
||||
inputs:create_index('delete_search' , {type = 'hash', parts={'input_id'}})
|
||||
inputs:create_index('spent_search' , {type = 'tree', unique=false, parts={'fulfills_transaction_id', 'fulfills_output_index'}})
|
||||
inputs:create_index('id_search', {type = 'tree', unique=false, parts = {'transaction_id'}})
|
||||
|
||||
outputs = box.schema.space.create('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'}})
|
||||
outputs:create_index('unique_search' ,{type='hash', parts={'output_id'}})
|
||||
outputs:create_index('id_search' ,{type='tree', unique=false, parts={'transaction_id'}})
|
||||
|
||||
keys = box.schema.space.create('keys')
|
||||
keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}})
|
||||
keys:create_index('id_search', {type = 'hash', parts={'id'}})
|
||||
keys:create_index('keys_search', {type = 'tree', unique=false, parts={'public_key'}})
|
||||
keys:create_index('txid_search', {type = 'tree', unique=false, parts={'transaction_id'}})
|
||||
keys:create_index('output_search', {type = 'tree', unique=false, parts={'output_id'}})
|
||||
|
||||
local console = require('console')
|
||||
console.start()
|
||||
@ -30,8 +30,8 @@ def __read_commands(file_path):
|
||||
|
||||
|
||||
def _load_setup_files():
|
||||
drop_commands = __read_commands(file_path="planetmint/backend/tarantool/drop_db.txt")
|
||||
init_commands = __read_commands(file_path="planetmint/backend/tarantool/init_db.txt")
|
||||
drop_commands = __read_commands(file_path="planetmint/backend/tarantool/drop.lua")
|
||||
init_commands = __read_commands(file_path="planetmint/backend/tarantool/init.lua")
|
||||
return init_commands, drop_commands
|
||||
|
||||
|
||||
|
||||
@ -49,11 +49,11 @@ class Config(metaclass=Singleton):
|
||||
'crlfile': None
|
||||
}
|
||||
self.__private_init_config = {
|
||||
"absolute_path": os.path.dirname(os.path.abspath(__file__)) + "/backend/tarantool/init_db.txt"
|
||||
"absolute_path": os.path.dirname(os.path.abspath(__file__)) + "/backend/tarantool/init.lua"
|
||||
}
|
||||
|
||||
self.__private_drop_config = {
|
||||
"absolute_path": os.path.dirname(os.path.abspath(__file__)) + "/backend/tarantool/drop_db.txt"
|
||||
"absolute_path": os.path.dirname(os.path.abspath(__file__)) + "/backend/tarantool/drop.lua"
|
||||
}
|
||||
self.__private_database_tarantool = {
|
||||
'backend': 'tarantool_db',
|
||||
@ -62,7 +62,7 @@ class Config(metaclass=Singleton):
|
||||
'name': 'bigchain',
|
||||
"reconnect_delay": 0.5,
|
||||
'host': 'localhost',
|
||||
'port': 3301,
|
||||
'port': 3303,
|
||||
"connect_now": True,
|
||||
"encoding": "utf-8",
|
||||
"login": "planetmint",
|
||||
|
||||
2
setup.py
2
setup.py
@ -139,5 +139,5 @@ setup(
|
||||
'docs': docs_require,
|
||||
},
|
||||
package_data={'planetmint.common.schema': ['*.yaml'],
|
||||
'planetmint.backend.tarantool': ['*.txt']}
|
||||
'planetmint.backend.tarantool': ['*.lua']}
|
||||
)
|
||||
|
||||
@ -318,9 +318,9 @@ def inputs(user_pk, b, alice):
|
||||
|
||||
@pytest.fixture
|
||||
def dummy_db(request):
|
||||
from planetmint.backend import connect
|
||||
from planetmint.backend import Connection
|
||||
|
||||
conn = connect()
|
||||
conn = Connection()
|
||||
dbname = request.fixturename
|
||||
xdist_suffix = getattr(request.config, 'slaveinput', {}).get('slaveid')
|
||||
if xdist_suffix:
|
||||
|
||||
@ -16,7 +16,7 @@ def config(request, monkeypatch):
|
||||
'database': {
|
||||
'backend': backend,
|
||||
'host': 'localhost',
|
||||
'port': 3301,
|
||||
'port': 3303,
|
||||
'name': 'bigchain',
|
||||
'replicaset': 'bigchain-rs',
|
||||
'connection_timeout': 5000,
|
||||
@ -74,6 +74,8 @@ def test_get_spent_issue_1271(b, alice, bob, carol):
|
||||
[carol.public_key],
|
||||
[([carol.public_key], 8)],
|
||||
).sign([carol.private_key])
|
||||
print( f" TX 1 : {tx_1} ")
|
||||
print( f" TX 1 ID : {tx_1.id} ")
|
||||
assert tx_1.validate(b)
|
||||
b.store_bulk_transactions([tx_1])
|
||||
|
||||
@ -84,6 +86,8 @@ def test_get_spent_issue_1271(b, alice, bob, carol):
|
||||
([carol.public_key], 4)],
|
||||
asset_id=tx_1.id,
|
||||
).sign([carol.private_key])
|
||||
print( f" TX 2 : {tx_2} ")
|
||||
print( f" TX 2 ID : {tx_2.id} ")
|
||||
assert tx_2.validate(b)
|
||||
b.store_bulk_transactions([tx_2])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user