Skip to content
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

feat(collections): IndexedMap #14397

Merged
merged 43 commits into from
Jan 27, 2023
Merged

feat(collections): IndexedMap #14397

merged 43 commits into from
Jan 27, 2023

Conversation

testinginprod
Copy link
Contributor

@testinginprod testinginprod commented Dec 22, 2022

Description

Closes: #14670


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@testinginprod testinginprod requested a review from a team as a code owner December 22, 2022 21:32
@testinginprod testinginprod marked this pull request as draft December 22, 2022 21:32
@sonarcloud
Copy link

sonarcloud bot commented Dec 23, 2022

[Cosmos SDK - Collections] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@faddat
Copy link
Contributor

faddat commented Dec 26, 2022

Hey, @testinginprod -- thanks for all this!

Really interesting, watching you lay this out.

@sonarcloud
Copy link

sonarcloud bot commented Dec 31, 2022

[Cosmos SDK] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Base automatically changed from tip/collections-pairkeys to main January 12, 2023 10:04
testinginprod and others added 4 commits January 13, 2023 17:46
# Conflicts:
#	collections/collections.go
#	collections/collections_test.go
#	collections/iter.go
#	collections/keys.go
#	collections/pair.go
#	collections/pair_test.go
@testinginprod testinginprod marked this pull request as ready for review January 19, 2023 14:37
@testinginprod
Copy link
Contributor Author

Built the concrete indexes here with examples: #14706

Comment on lines +38 to +39
* [#14397](https://github.com/cosmos/cosmos-sdk/pull/14397) Add IndexedMap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH these changelog entries are superfluous -- as a dev, they tell me nothing useful.

Honestly, we can probably have a single collections CL entry that outlines all the additions and changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it makes sense to me. When we release the first "stable" version we can add a comprehensive list of the features in the changelog, and then apply the classic by PR changelog after the first release.

collections/map.go Show resolved Hide resolved
collections/indexes_generic_unique_test.go Outdated Show resolved Hide resolved
}

// NewGenericUniqueIndex instantiates a GenericUniqueIndex. Works in the same way as NewGenericMultiIndex.
func NewGenericUniqueIndex[ReferencingKey, ReferencedKey, PrimaryKey, Value any](
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an example of how/where this is to be used? As a developer looking at this and trying to understand how to use it, I would be pretty confused as I find it somewhat daunting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14706, this is where the real indexes are implemented, I've also added the examples

testinginprod added 2 commits January 23, 2023 19:21
# Conflicts:
#	collections/collections_test.go
#	collections/iter.go
#	collections/map.go
#	go.mod
#	go.sum
#	simapp/go.sum
#	tests/go.mod
#	tests/go.sum
#	x/nft/go.sum
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UtACK

Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few nits

collections/indexed_map.go Outdated Show resolved Hide resolved
collections/indexed_map.go Show resolved Hide resolved
collections/indexes_generic_multi.go Outdated Show resolved Hide resolved
testinginprod and others added 4 commits January 27, 2023 12:04
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
@testinginprod testinginprod enabled auto-merge (squash) January 27, 2023 12:38
@testinginprod testinginprod merged commit 519630e into main Jan 27, 2023
@testinginprod testinginprod deleted the tip/indexed_map branch January 27, 2023 12:49
tsenart pushed a commit to meka-dev/cosmos-sdk that referenced this pull request Apr 12, 2023
Co-authored-by: testinginprod <testinginprod@somewhere.idk>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

collections: IndexedMap
6 participants