mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
Pushing delete queries for tarantool
This commit is contained in:
parent
1c444cda79
commit
56c8f72570
@ -293,10 +293,19 @@ def get_block_with_transaction(txid, connection):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def delete_transactions(conn, txn_ids):
|
def delete_transactions(connection, txn_ids):
|
||||||
conn.run(conn.collection('assets').delete_many({'id': {'$in': txn_ids}}))
|
space = connection.space("transactions")
|
||||||
conn.run(conn.collection('metadata').delete_many({'id': {'$in': txn_ids}}))
|
for _id in txn_ids:
|
||||||
conn.run(conn.collection('transactions').delete_many({'id': {'$in': txn_ids}}))
|
space.delete(_id)
|
||||||
|
inputs_space = connection.space("inputs")
|
||||||
|
outputs_space = connection.space("outputs")
|
||||||
|
for _id in txn_ids:
|
||||||
|
_inputs = inputs_space.select(_id, index="id_search")
|
||||||
|
_outputs = outputs_space.select(_id, index="id_search")
|
||||||
|
for _inpID in _inputs:
|
||||||
|
space.delete(_inpID[5])
|
||||||
|
for _outpID in _outputs:
|
||||||
|
space.delete(_outpID[5])
|
||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
@ -367,10 +376,11 @@ def store_validator_set(validators_update, connection):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def delete_validator_set(conn, height):
|
def delete_validator_set(connection, height):
|
||||||
return conn.run(
|
space = connection.space("validators")
|
||||||
conn.collection('validators').delete_many({'height': height})
|
_validators = space.select(height, index="height_search")
|
||||||
)
|
for _valid in _validators.data:
|
||||||
|
space.delete(_valid[0])
|
||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
@ -393,10 +403,11 @@ def store_elections(elections, connection):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def delete_elections(conn, height):
|
def delete_elections(connection, height):
|
||||||
return conn.run(
|
space = connection.space("elections")
|
||||||
conn.collection('elections').delete_many({'height': height})
|
_elections = space.select(height, index="height_search")
|
||||||
)
|
for _elec in _elections.data:
|
||||||
|
space.delete(_elec[0])
|
||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
@ -443,10 +454,11 @@ def store_abci_chain(height, chain_id, connection, is_synced=True):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def delete_abci_chain(conn, height):
|
def delete_abci_chain(connection, height):
|
||||||
return conn.run(
|
space = connection.space("abci_chains")
|
||||||
conn.collection('abci_chains').delete_many({'height': height})
|
_chains = space.select(height, index="height_search")
|
||||||
)
|
for _chain in _chains.data:
|
||||||
|
space.delete(_chain[2])
|
||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user