-
Notifications
You must be signed in to change notification settings - Fork 269
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
chore(docs): add documents of db
#888
Conversation
WalkthroughThe recent update focuses on enhancing database flexibility and efficiency. It introduces a new database package to replace the dependency on Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
# DB | ||
|
||
The `db` package contains the key-value database interface and `memdb` implementation. The `memdb` is a simple in-memory key-value store that is used for testing and development purposes. | ||
|
||
## Context | ||
|
||
The main purpose of the `db` package is to provide decoupling between `cosmos-db` and `iavl` packages. It provides a simple `wrapper` for the old users of `iavl` and `cosmos-db` to use the new `db` package without changing their code. For example: | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"cosmossdk.io/log" | ||
dbm "github.com/cosmos/cosmos-db" | ||
|
||
"github.com/cosmos/iavl" | ||
idbm "github.com/cosmos/iavl/db" | ||
) | ||
|
||
func main() { | ||
levelDB, err := dbm.NewDB("application", dbm.GoLevelDBBackend, "test") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
tree := iavl.NewMutableTree(idbm.NewWrapper(dbm.NewPrefixDB(levelDB, []byte("s/k:main/"))), 0, false, log.NewNopLogger()) | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README.md provides a clear overview of the db
package, its purpose, and a practical example of how to use it. However, there are a few areas that could be improved for clarity and completeness:
- It would be beneficial to include more details about the
db
package's capabilities beyond thememdb
implementation, especially if there are other key-value stores supported or planned. - The example code is helpful, but adding comments within the code to explain each step would make it more accessible to newcomers.
- A section on how to migrate from
cosmos-db
to the newdb
package could be valuable for users looking for a smooth transition. - Including information on performance considerations, limitations, or best practices when using the
db
package could provide users with a more comprehensive understanding.
Overall, the documentation is a good starting point but could be enhanced to offer more guidance and information to users.
@@ -4,6 +4,7 @@ | |||
|
|||
### Improvements | |||
|
|||
- [#874](https://github.com/cosmos/iavl/pull/874) Decouple `cosmos-db` and implement own `db` package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The improvements listed in the Unreleased section of the CHANGELOG.md accurately reflect the significant changes made to the project, including the decoupling from cosmos-db
, introduction of new APIs, and performance optimizations. However, it would be beneficial to include more context or details for each item to help users understand the impact of these changes better. For example:
- For the decoupling of
cosmos-db
, briefly explain the benefits or reasons behind this move. - For new APIs like
SaveChangeSet
,NewCompressExporter
, andNewCompressImporter
, a short description of their use cases or advantages would be helpful. - The performance optimization for Genesis writes could include information on the expected improvements or how users can leverage this optimization.
Enhancing the descriptions in the CHANGELOG.md will provide users with a clearer understanding of the changes and how they can benefit from them.
Context
ref: #874