-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(schema/indexer)!: implement start indexing #21636
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
421ceb1
simplify PR
aaronc 6e20448
feat(schema/indexer)!: implement indexing initialization
aaronc bbc9743
refactor
aaronc 7c56339
docs
aaronc 309eb61
update postgres indexer to use indexer.Start
aaronc 2d854e8
docs
aaronc 01f7437
Merge branch 'main' of github.com:cosmos/cosmos-sdk into aaronc/index…
aaronc dc7f0a8
WIP on testing
aaronc de3c622
WIP on testing
aaronc 5459a26
more tests
aaronc c967f78
update struct tags
aaronc 9038cca
Merge branch 'main' into aaronc/indexer-manager-impl1
aaronc 300629d
Merge branch 'main' into aaronc/indexer-manager-impl1
tac0turtle b20ab7b
Merge branch 'main' into aaronc/indexer-manager-impl1
aaronc 0bb6485
fix go 1.12 build
aaronc b3e4280
Merge remote-tracking branch 'origin/aaronc/indexer-manager-impl1' in…
aaronc 544003a
update golden tests
aaronc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package indexer | ||
|
||
// Config species the configuration passed to an indexer initialization function. | ||
// It includes both common configuration options related to include or excluding | ||
// parts of the data stream as well as indexer specific options under the config | ||
// subsection. | ||
// | ||
// NOTE: it is an error for an indexer to change its common options, such as adding | ||
// or removing indexed modules, after the indexer has been initialized because this | ||
// could result in an inconsistent state. | ||
type Config struct { | ||
// Type is the name of the indexer type as registered with Register. | ||
Type string `mapstructure:"type" toml:"type" json:"type" comment:"The name of the registered indexer type."` | ||
|
||
// Config are the indexer specific config options specified by the user. | ||
Config interface{} `mapstructure:"config" toml:"config" json:"config,omitempty" comment:"Indexer specific configuration options."` | ||
|
||
// Filter is the filter configuration for the indexer. | ||
Filter *FilterConfig `mapstructure:"filter" toml:"filter" json:"filter,omitempty" comment:"Filter configuration for the indexer. Currently UNSUPPORTED!"` | ||
} | ||
|
||
// FilterConfig specifies the configuration for filtering the data stream | ||
type FilterConfig struct { | ||
// ExcludeState specifies that the indexer will not receive state updates. | ||
ExcludeState bool `mapstructure:"exclude_state" toml:"exclude_state" json:"exclude_state" comment:"Exclude all state updates."` | ||
|
||
// ExcludeEvents specifies that the indexer will not receive events. | ||
ExcludeEvents bool `mapstructure:"exclude_events" toml:"exclude_events" json:"exclude_events" comment:"Exclude all events."` | ||
|
||
// ExcludeTxs specifies that the indexer will not receive transaction's. | ||
ExcludeTxs bool `mapstructure:"exclude_txs" toml:"exclude_txs" json:"exclude_txs" comment:"Exclude all transactions."` | ||
|
||
// ExcludeBlockHeaders specifies that the indexer will not receive block headers, | ||
// although it will still receive StartBlock and Commit callbacks, just without | ||
// the header data. | ||
ExcludeBlockHeaders bool `mapstructure:"exclude_block_headers" toml:"exclude_block_headers" json:"exclude_block_headers" comment:"Exclude all block headers."` | ||
|
||
Modules *ModuleFilterConfig `mapstructure:"modules" toml:"modules" json:"modules,omitempty" comment:"Module filter configuration."` | ||
} | ||
|
||
// ModuleFilterConfig specifies the configuration for filtering modules. | ||
type ModuleFilterConfig struct { | ||
// Include specifies a list of modules whose state the indexer will | ||
// receive state updates for. | ||
// Only one of include or exclude modules should be specified. | ||
Include []string `mapstructure:"include" toml:"include" json:"include" comment:"List of modules to include. Only one of include or exclude should be specified."` | ||
|
||
// Exclude specifies a list of modules whose state the indexer will not | ||
// receive state updates for. | ||
// Only one of include or exclude modules should be specified. | ||
Exclude []string `mapstructure:"exclude" toml:"exclude" json:"exclude" comment:"List of modules to exclude. Only one of include or exclude should be specified."` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
will this be set in the app.toml or?
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.
Yes the idea is that this is a section in app.toml, probably under the [indexer] section
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.
Can we then add the corresponding
toml
struct tag then? (Like done in other server/v2 config struct)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.
Which tags do we want?
toml
,mapstructure
,json
? One of these? All three?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.
toml, mapstructure and comment: https://github.com/cosmos/cosmos-sdk/blob/main/server/v2/api/grpc/config.go
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.
So no json needed?
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.
I went ahead and added toml, mapstructure and comment and also kept JSON: c967f78. Does that look good?