-
Notifications
You must be signed in to change notification settings - Fork 93
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
Conduit: Dynamic on complete #1285
Conversation
@@ -158,6 +160,20 @@ func (p *pipelineImpl) setError(err error) { | |||
p.err = err | |||
} | |||
|
|||
func (p *pipelineImpl) registerLifecycleCallbacks() { | |||
if v, ok := (*p.importer).(Completed); 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.
neat.
conduit/pipeline.go
Outdated
importer *importers.Importer | ||
processors []*processors.Processor | ||
exporter *exporters.Exporter | ||
completeCallback []Completed |
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 not sure if this needs to be []*Completed
or not. I think all of our plugins use pointer receivers, so they are already pointers, but maybe that isn't always the case.
9777d4a
to
4b1ca63
Compare
Looks like the lint is failing, but otherwise really cool refactoring! |
92ce73c
to
c9c4cee
Compare
Codecov Report
@@ Coverage Diff @@
## conduit #1285 +/- ##
===========================================
+ Coverage 60.24% 60.31% +0.07%
===========================================
Files 76 76
Lines 10034 10042 +8
===========================================
+ Hits 6045 6057 +12
+ Misses 3463 3459 -4
Partials 526 526
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Summary
It seemed like this function is useful to any plugin, so I have implemented it in a dynamic way.
Any plugin can now add an
OnComplete
callback if they need it, and do not need to provide it if they do not.Test Plan
Update tests.