-
Notifications
You must be signed in to change notification settings - Fork 26
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
file-plugins: enabling messagepack format #142
Conversation
Codecov Report
@@ Coverage Diff @@
## master #142 +/- ##
==========================================
+ Coverage 67.66% 71.31% +3.65%
==========================================
Files 32 37 +5
Lines 1976 2761 +785
==========================================
+ Hits 1337 1969 +632
- Misses 570 690 +120
- Partials 69 102 +33
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
conduit/plugins/importers/filereader/test_resources/conduit_data/conduit.yml
Outdated
Show resolved
Hide resolved
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.
These test fixtures were generated using the block generator scenario config.allmixed.small.yml
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 actual feature looks fine, nice improvement. I have some misc questions and comments about the refactoring and some potential dead code.
conduit/pipeline/pipeline.go
Outdated
@@ -103,29 +101,23 @@ func (p *pipelineImpl) registerPluginMetricsCallbacks() { | |||
} | |||
} | |||
|
|||
// makeConfig creates a plugin config from a name and config pair. | |||
// configWithLogger creates a plugin config from a name and config pair. |
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.
why rename this? Seems unrelated to the rest of the PR
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.
In order to set up the integration test, I wanted to break-out the pure config generating portion to a new method pluginType.GetConfig()
. With this refactoring, it's clearer that this method does 2 things:
- sets up the plugin's config
- returns a logger that inherits the pipeline's logger setup
These seemed sufficiently unrelated to me that I thought it was worth rename.
However, renaming is not at all crucial.
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.
@@ -0,0 +1,72 @@ | |||
# Log verbosity: PANIC, FATAL, ERROR, WARN, INFO, DEBUG, TRACE | |||
log-level: INFO |
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'd consider making this programmatically, or removing as much as possible so that there's less opportunity for things to become stale.
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 genesis file is available __in addition to__ the round 0 block file. | ||
// This is because the encoding assumed for the genesis is different | ||
// from the encoding assumed for blocks. | ||
// TODO: handle the case of a multipurpose file that contains both encodings. |
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.
Could you elaborate on this TODO in the comment? As it is, I'm not sure exactly what you have in mind.
Also, the canonical genesis file is json. Maybe we should always write it that way?
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.
What I mean in the TODO is that in principle, it's possible to have a block 0 which includes both the genesis information as well as the block information. But you hint that this may not be such a great idea and we should probably just assume we have a genesis.json
since that's canonical. Does it actually make sense to have a round 0? Should we eliminate the concept?
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.
Plan:
- remove TODO
- file exporter/importer ASSUME genesis.json
- continue with block 0 in appropriate encoding
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.
conduit/plugins/metadata.go
Outdated
) | ||
|
||
// GetConfig creates an appropriate plugin config for the type. | ||
func (pt PluginType) GetConfig(cfg data.NameConfigPair, dataDir string) (PluginConfig, error) { |
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.
What is this for? I'm having a hard time figuring out where it's used. There are already several patterns for creating test configurations in the other plugin tests, I think it would be better to use/refine one of those rather than adding a new scheme.
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'm only using it in fileReadWrite_test.go
, and also in the recently renamed pipelineImpl.configWithLogger()
. I can easily recreate the logic in the test and revert this new function. I'll go ahead and do that, but I'm going to keep the added typing in this file to the constants Exporter, Processor
and Importer
as I believe that was the original intent.
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.
Thanks, yes please revert this and add a test helper if necessary. I think this is unique to the filereader/filewriter e2e test, so it probably doesn't need to be a generally available utility.
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.
…from fileReadWrite_test.go
genesis := initProvider.GetGenesis() | ||
genesisPath := path.Join(exp.cfg.BlocksDir, GenesisFilename) |
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.
This was missing before?
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.
Yeah
Co-authored-by: Will Winder <[email protected]>
File Plugins: Add Messagepack Format and Default to
msgp.gz
Based on the extension of the file pattern provided in a
file_reader
orfile_writer
plugin, choose:.msgp
or.json
).gz
)When no pattern is provided, it defaults to
*.msgp.gz
Test Plan
This is all tested in CI including a new integration test
conduit/plugins/importers/filereader/fileReadWrite_test.go