Rename Tag(s) to Event(s) (#4046)

* Rename Tag(s) to Event(s)

- tag was replaced with event, but in some places it still mentions tag, would be easier to understand if we tried to replace it with event to not confuse people.

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* more  changes from tag -> event

* rename events to compositeKeys and keys

* Apply suggestions from code review

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* add minor documentation on how composite keys are constructed

* rename eventkey to compositekey

Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>

* add changelog entry & add info to regenerate confid to changelog entry
This commit is contained in:
Marko
2019-12-04 12:37:48 +01:00
committed by GitHub
parent 1c46145be7
commit 92d18d7fcd
21 changed files with 157 additions and 129 deletions

View File

@@ -10,12 +10,23 @@ to their results.
Events can be used to index transactions and blocks according to what happened
during their execution. Note that the set of events returned for a block from
`BeginBlock` and `EndBlock` are merged. In case both methods return the same
tag, only the value defined in `EndBlock` is used.
type, only the key-value pairs defined in `EndBlock` are used.
Each event contains a type and a list of attributes, which are key-value pairs
denoting something about what happened during the method's execution. For more
details on `Events`, see the [ABCI](../spec/abci/abci.md) documentation.
An Event has a composite key associated with it. A `compositeKey` is constructed by its type and key separated by a dot.
For example:
```json
"jack": [
"account.number": 100
]
```
would be equal to the composite key of `jack.account.number`.
Let's take a look at the `[tx_index]` config section:
```toml
@@ -29,22 +40,22 @@ Let's take a look at the `[tx_index]` config section:
# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
indexer = "kv"
# Comma-separated list of tags to index (by default the only tag is "tx.hash")
# Comma-separated list of composite keys to index (by default the only key is "tx.hash")
#
# You can also index transactions by height by adding "tx.height" tag here.
# You can also index transactions by height by adding "tx.height" key here.
#
# It's recommended to index only a subset of tags due to possible memory
# It's recommended to index only a subset of keys due to possible memory
# bloat. This is, of course, depends on the indexer's DB and the volume of
# transactions.
index_tags = ""
index_keys = ""
# When set to true, tells indexer to index all tags (predefined tags:
# "tx.hash", "tx.height" and all tags from DeliverTx responses).
# When set to true, tells indexer to index all compositeKeys (predefined keys:
# "tx.hash", "tx.height" and all keys from DeliverTx responses).
#
# Note this may be not desirable (see the comment above). IndexTags has a
# precedence over IndexAllTags (i.e. when given both, IndexTags will be
# Note this may be not desirable (see the comment above). Indexkeys has a
# precedence over IndexAllKeys (i.e. when given both, IndexKeys will be
# indexed).
index_all_tags = false
index_all_keys = false
```
By default, Tendermint will index all transactions by their respective
@@ -100,17 +111,17 @@ on query syntax and other options.
## Subscribing to Transactions
Clients can subscribe to transactions with the given tags via Websocket by providing
Clients can subscribe to transactions with the given tags via WebSocket by providing
a query to `/subscribe` RPC endpoint.
```json
{
"jsonrpc": "2.0",
"method": "subscribe",
"id": "0",
"params": {
"query": "account.name='igor'"
}
"jsonrpc": "2.0",
"method": "subscribe",
"id": "0",
"params": {
"query": "account.name='igor'"
}
}
```