Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Store (aka ORM) Package #7098

Closed
aaronc opened this issue Aug 18, 2020 · 0 comments
Closed

Table Store (aka ORM) Package #7098

aaronc opened this issue Aug 18, 2020 · 0 comments

Comments

@aaronc
Copy link
Member

aaronc commented Aug 18, 2020

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 (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.

@aaronc aaronc changed the title Table Store (aka ORM) Module Table Store (aka ORM) Package Aug 18, 2020
@aaronc aaronc mentioned this issue Oct 22, 2020
4 tasks
@aaronc aaronc closed this as completed Apr 21, 2021
@cosmos cosmos locked and limited conversation to collaborators Apr 21, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant