You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oftentimes modules want to create secondary indexes for data being stored. A good example is x/staking (see x/staking/types/keys.go). As can be seen in the x/staking example, it is fairly complex to do this manually.
Proposal
The table-store package would provide a framework for creating effectively database tables with primary and secondary keys.
The current implementation of this is called orm (for object-relational mapping), but a more correct name is likely table-store. Instead of a key-value store, we actually have a relational database table store.
Currently this implementation has support for:
auto-incrementing uint64 primary keys
natural primary keys
uint64 secondary indexes
[]byte secondary indexes
multi-key secondary indexes
More functionality could be added as needed.
This is related to the proposed schema module (see #7097). The table-store module would automatically generate schema descriptors for registered tables whereas existing modules would need to create those schemas manually.
The text was updated successfully, but these errors were encountered:
This is linked to meta-issue #7096.
Summary
This issue proposes a new table-store package which allows for automatic secondary index creation. The code for this already exists here: https://github.com/regen-network/cosmos-modules/tree/master/incubator/orm but it is not part of the SDK.
Problem Definition
Oftentimes modules want to create secondary indexes for data being stored. A good example is
x/staking
(seex/staking/types/keys.go
). As can be seen in thex/staking
example, it is fairly complex to do this manually.Proposal
The table-store package would provide a framework for creating effectively database tables with primary and secondary keys.
The current implementation of this is called
orm
(for object-relational mapping), but a more correct name is likely table-store. Instead of a key-value store, we actually have a relational database table store.Currently this implementation has support for:
uint64
primary keysuint64
secondary indexes[]byte
secondary indexesMore functionality could be added as needed.
This is related to the proposed schema module (see #7097). The table-store module would automatically generate schema descriptors for registered tables whereas existing modules would need to create those schemas manually.
The text was updated successfully, but these errors were encountered: