-
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
pipelineImpl: de-pointerize plugin interface fields #113
pipelineImpl: de-pointerize plugin interface fields #113
Conversation
Codecov Report
@@ Coverage Diff @@
## master #113 +/- ##
==========================================
+ Coverage 67.66% 70.38% +2.72%
==========================================
Files 32 37 +5
Lines 1976 2509 +533
==========================================
+ Hits 1337 1766 +429
- Misses 570 648 +78
- Partials 69 95 +26
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
conduit/pipeline/pipeline.go
Outdated
@@ -306,11 +306,11 @@ func (p *pipelineImpl) Init() error { | |||
if err != nil { | |||
return fmt.Errorf("Pipeline.Init(): could not make %s config: %w", p.cfg.Importer.Name, err) | |||
} | |||
err = (*p.importer).Init(p.ctx, *p.initProvider, pluginConfig, importerLogger) | |||
err = (p.importer).Init(p.ctx, *p.initProvider, pluginConfig, importerLogger) |
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.
Are the parens still needed?
err = (p.importer).Init(p.ctx, *p.initProvider, pluginConfig, importerLogger) | |
err = p.importer.Init(p.ctx, *p.initProvider, pluginConfig, importerLogger) |
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/pipeline/pipeline.go
Outdated
@@ -574,8 +696,7 @@ func MakePipeline(ctx context.Context, cfg *data.Config, logger *log.Logger) (Pi | |||
return nil, fmt.Errorf("MakePipeline(): could not build importer '%s': %w", importerName, err) | |||
} | |||
|
|||
importer := importerBuilder.New() | |||
pipeline.importer = &importer | |||
pipeline.importer = importerBuilder.New() |
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 change and the ones below in this file aren't needed, but seem ok.
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.
Well, partially they're needed, but we don't really need to remove the extra variable assignment as I'm doing here.
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.
Not sure why this variable is named "Builder". This is the "Constructor" and "New" is the single function defined in the constructor interface. The function above should be importers.ImporterConstructorByName
.
What you have here is correct, previously it had to be assigned separately so that we could get the pointer.
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've made changes in this commit:
However, now the PR has evolved from a non-breaking change to a quasi-breaking change since it's possible that someone can attempt to use the renamed interfaces explicitly and their code will reference these no longer existing types.
LMK
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. Up to you, I don't feel very strongly. Was just calling out a possible reason for the discrepancy because you mentioned it in your top comment.
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.
Went ahead and merged. We should discuss how to communicate this for our next release.
conduit/pipeline/pipeline.go
Outdated
@@ -574,8 +696,7 @@ func MakePipeline(ctx context.Context, cfg *data.Config, logger *log.Logger) (Pi | |||
return nil, fmt.Errorf("MakePipeline(): could not build importer '%s': %w", importerName, err) | |||
} | |||
|
|||
importer := importerBuilder.New() | |||
pipeline.importer = &importer | |||
pipeline.importer = importerBuilder.New() |
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.
Not sure why this variable is named "Builder". This is the "Constructor" and "New" is the single function defined in the constructor interface. The function above should be importers.ImporterConstructorByName
.
What you have here is correct, previously it had to be assigned separately so that we could get the pointer.
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
Summary
Non-breaking changes:
pipelineImpl
struct to be "concrete" interface types.Quasi-breaking changes:
*Builder
variables and types to be*Constructor
Constructor
interface which was used for constructing Importers to beImporterConstructor
in line with other such plugin related types.Test Plan
CI
Testing TODO's
Results of the local block generator run
It's working just as before. Below is a screen shot comparing the run's report with what's in the database. Additionally, the conduit-log had no errors.