mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Expand abbrevation "txn" to transaction
This commit is contained in:
parent
cb92248855
commit
afd643c41d
@ -43,10 +43,10 @@ def store_metadata(conn, metadata):
|
|||||||
|
|
||||||
|
|
||||||
@register_query(LocalMongoDBConnection)
|
@register_query(LocalMongoDBConnection)
|
||||||
def get_metadata(conn, txn_ids):
|
def get_metadata(conn, transaction_ids):
|
||||||
return conn.run(
|
return conn.run(
|
||||||
conn.collection('metadata')
|
conn.collection('metadata')
|
||||||
.find({'id': {'$in': txn_ids}},
|
.find({'id': {'$in': transaction_ids}},
|
||||||
projection={'_id': False}))
|
projection={'_id': False}))
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ def create_metadata_secondary_index(conn, dbname):
|
|||||||
|
|
||||||
# the id is the txid of the transaction where metadata was defined
|
# the id is the txid of the transaction where metadata was defined
|
||||||
conn.conn[dbname]['metadata'].create_index('id',
|
conn.conn[dbname]['metadata'].create_index('id',
|
||||||
name='txn_id',
|
name='transaction_id',
|
||||||
unique=True)
|
unique=True)
|
||||||
|
|
||||||
# full text search index
|
# full text search index
|
||||||
|
@ -35,10 +35,10 @@ def store_asset(connection, asset):
|
|||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def store_metadata(connection, metadata):
|
def store_metadata(connection, metadata):
|
||||||
"""Write an asset to the asset table.
|
"""Write metadata to the metadata table.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
asset (dict): the asset.
|
metadata (dict): transaction metadata.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The result of the operation.
|
The result of the operation.
|
||||||
@ -345,11 +345,11 @@ def get_assets(connection, asset_ids):
|
|||||||
|
|
||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def get_metadata(connection, txn_ids):
|
def get_metadata(connection, transaction_ids):
|
||||||
"""Get a list of metadata from the metadata table.
|
"""Get a list of metadata from the metadata table.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
txn_ids (list): a list of ids for the metadata to be retrieved from
|
transaction_ids (list): a list of ids for the metadata to be retrieved from
|
||||||
the database.
|
the database.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -52,10 +52,10 @@ class BigchainDB(Bigchain):
|
|||||||
backend.query.store_asset(self.connection, asset)
|
backend.query.store_asset(self.connection, asset)
|
||||||
|
|
||||||
metadata = transaction.pop('metadata')
|
metadata = transaction.pop('metadata')
|
||||||
txn_metadata = {'id': transaction['id'],
|
transaction_metadata = {'id': transaction['id'],
|
||||||
'metadata': metadata}
|
'metadata': metadata}
|
||||||
|
|
||||||
backend.query.store_metadata(self.connection, [txn_metadata])
|
backend.query.store_metadata(self.connection, [transaction_metadata])
|
||||||
|
|
||||||
return backend.query.store_transaction(self.connection, transaction)
|
return backend.query.store_transaction(self.connection, transaction)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user