mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Consistent naming on the events api
This commit is contained in:
@@ -26,7 +26,7 @@ from bigchaindb.events import EventTypes
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
POISON_PILL = 'POISON_PILL'
|
POISON_PILL = 'POISON_PILL'
|
||||||
EVENTS_ENDPOINT = '/api/v1/streams/valid_tx'
|
EVENTS_ENDPOINT = '/api/v1/streams/valid_transactions'
|
||||||
|
|
||||||
|
|
||||||
def _multiprocessing_to_asyncio(in_queue, out_queue, loop):
|
def _multiprocessing_to_asyncio(in_queue, out_queue, loop):
|
||||||
@@ -91,7 +91,7 @@ class Dispatcher:
|
|||||||
asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id']
|
asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id']
|
||||||
data = {'block_id': block['id'],
|
data = {'block_id': block['id'],
|
||||||
'asset_id': asset_id,
|
'asset_id': asset_id,
|
||||||
'tx_id': tx['id']}
|
'transaction_id': tx['id']}
|
||||||
str_buffer.append(json.dumps(data))
|
str_buffer.append(json.dumps(data))
|
||||||
|
|
||||||
for _, websocket in self.subscribers.items():
|
for _, websocket in self.subscribers.items():
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ response contains a ``streams`` property:
|
|||||||
|
|
||||||
{
|
{
|
||||||
...,
|
...,
|
||||||
"streams": "ws://example.com:9985/api/v1/streams/valid_tx",
|
"streams": "ws://example.com:9985/api/v1/streams/valid_transactions",
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ BigchainDB node will be ignored.
|
|||||||
Streams will always be under the WebSocket protocol (so ``ws://`` or
|
Streams will always be under the WebSocket protocol (so ``ws://`` or
|
||||||
``wss://``) and accessible as extensions to the ``/api/v<version>/streams/``
|
``wss://``) and accessible as extensions to the ``/api/v<version>/streams/``
|
||||||
API root URL (for example, `validated transactions <#valid-transactions>`_
|
API root URL (for example, `validated transactions <#valid-transactions>`_
|
||||||
would be accessible under ``/api/v1/streams/valid_tx``). If you're running your
|
would be accessible under ``/api/v1/streams/valid_transactions``). If you're
|
||||||
own BigchainDB instance and need help determining its root URL,
|
running your own BigchainDB instance and need help determining its root URL,
|
||||||
then see the page titled :ref:`Determining the API Root URL`.
|
then see the page titled :ref:`Determining the API Root URL`.
|
||||||
|
|
||||||
All messages sent in a stream are in the JSON format.
|
All messages sent in a stream are in the JSON format.
|
||||||
@@ -77,7 +77,7 @@ All messages sent in a stream are in the JSON format.
|
|||||||
Valid Transactions
|
Valid Transactions
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
``/valid_tx``
|
``/valid_transactions``
|
||||||
|
|
||||||
Streams an event for any newly validated transactions. Message bodies contain
|
Streams an event for any newly validated transactions. Message bodies contain
|
||||||
the transaction's ID, associated asset ID, and containing block's ID.
|
the transaction's ID, associated asset ID, and containing block's ID.
|
||||||
@@ -87,7 +87,7 @@ Example message:
|
|||||||
.. code:: JSON
|
.. code:: JSON
|
||||||
|
|
||||||
{
|
{
|
||||||
"tx_id": "<sha3-256 hash>",
|
"transaction_id": "<sha3-256 hash>",
|
||||||
"asset_id": "<sha3-256 hash>",
|
"asset_id": "<sha3-256 hash>",
|
||||||
"block_id": "<sha3-256 hash>"
|
"block_id": "<sha3-256 hash>"
|
||||||
}
|
}
|
||||||
@@ -98,6 +98,6 @@ Example message:
|
|||||||
Transactions in BigchainDB are validated in batches ("blocks") and will,
|
Transactions in BigchainDB are validated in batches ("blocks") and will,
|
||||||
therefore, be streamed in batches. Each block can contain up to a 1000
|
therefore, be streamed in batches. Each block can contain up to a 1000
|
||||||
transactions, ordered by the time at which they were included in the block.
|
transactions, ordered by the time at which they were included in the block.
|
||||||
The ``/valid_tx`` stream will send these transactions in the same order
|
The ``/valid_transactions`` stream will send these transactions in the same
|
||||||
that the block stored them in, but this does **NOT** guarantee that you
|
order that the block stored them in, but this does **NOT** guarantee that
|
||||||
will recieve the events in that same order.
|
you will recieve the events in that same order.
|
||||||
|
|||||||
Reference in New Issue
Block a user