Skip to content

Commit

Permalink
Fix typos (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfmpe authored Mar 9, 2020
1 parent 175c1e7 commit e46dd33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hs-abci-docs/nameservice/tutorial/Foundations/04-Storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ title: Foundations - Storage

# Database

ABCI application depend on some kind of merkelized storage in order the achieve consensus on valid a application state. The SDK has two database options to interpret `StoreEffs`, an in-memory [avl-auth](https://github.com/oscoin/avl-auth) option as well as a persisted [iavl](https://github.com/tendermint/iavl) option.
ABCI applications depend on some kind of merkelized storage in order to achieve consensus on a valid application state. The SDK has two database options to interpret `StoreEffs`, an in-memory [avl-auth](https://github.com/oscoin/avl-auth) option as well as a persisted [iavl](https://github.com/tendermint/iavl) option.

# Stores

The most convenient way to partition a key-value store is by heavy use of prefixes -- for example, if you want to separate each module's keyspace, you can use prefix all of the keys that it manages by the module's unique name. If you want to partition storage within a module, say for a list or mapping, you can again use prefixes to create a unique keyspace.

The definition of a `Store` is a unique keyspace. Implementation wise, it is effectively a list of prefixes to concatonate when creating keys. There are currently 6 ways of creating Stores:
The definition of a `Store` is a unique keyspace. Implementation wise, it is effectively a list of prefixes to concatenate when creating keys. There are currently 6 ways of creating Stores:

1. From a `KeyRoot`, which is basically defines a top level Store.
1. From a `KeyRoot`, which basically defines a top level Store.
2. Using the `nestStore` function to mount one Store in another.
3. By creating a `Var`, which creates a keyspace with exactly one key.
4. By creating an `Array`, which creates a keyspace whose keys are type `Word64`.
Expand Down Expand Up @@ -74,4 +74,4 @@ This both creates the mapping and mounts it inside of our module level store. Th
encodeUtf8 "auth" <> encodeUtf8 "accounts" <> bytesFromHex "0xdeafbeef"
~~~

While writing apps inside the SDK you do not need to worry about the explicit prefixing since everything is taken care of for you. However, if you are querying for state via an ABCI `query` message, the `key` field that is returned in the response will contain this full path. In the above example, if you wanted to recover the address from the key, you would need to know the prefixes that were applied.
While writing apps inside the SDK you do not need to worry about the explicit prefixing since everything is taken care of for you. However, if you are querying for state via an ABCI `query` message, the `key` field that is returned in the response will contain this full path. In the above example, if you wanted to recover the address from the key, you would need to know the prefixes that were applied.

0 comments on commit e46dd33

Please sign in to comment.