Consistent naming on the events api

This commit is contained in:
Rodolphe Marques
2017-06-14 10:36:23 +02:00
parent fa04899003
commit f1a9650679
2 changed files with 10 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ from bigchaindb.events import EventTypes
logger = logging.getLogger(__name__)
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):
@@ -91,7 +91,7 @@ class Dispatcher:
asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id']
data = {'block_id': block['id'],
'asset_id': asset_id,
'tx_id': tx['id']}
'transaction_id': tx['id']}
str_buffer.append(json.dumps(data))
for _, websocket in self.subscribers.items():

View File

@@ -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
``wss://``) and accessible as extensions to the ``/api/v<version>/streams/``
API root URL (for example, `validated transactions <#valid-transactions>`_
would be accessible under ``/api/v1/streams/valid_tx``). If you're running your
own BigchainDB instance and need help determining its root URL,
would be accessible under ``/api/v1/streams/valid_transactions``). If you're
running your own BigchainDB instance and need help determining its root URL,
then see the page titled :ref:`Determining the API Root URL`.
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_tx``
``/valid_transactions``
Streams an event for any newly validated transactions. Message bodies contain
the transaction's ID, associated asset ID, and containing block's ID.
@@ -87,7 +87,7 @@ Example message:
.. code:: JSON
{
"tx_id": "<sha3-256 hash>",
"transaction_id": "<sha3-256 hash>",
"asset_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,
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.
The ``/valid_tx`` stream will send these transactions in the same order
that the block stored them in, but this does **NOT** guarantee that you
will recieve the events in that same order.
The ``/valid_transactions`` stream will send these transactions in the same
order that the block stored them in, but this does **NOT** guarantee that
you will recieve the events in that same order.