-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/incremental producer #46
Conversation
b5192e0
to
73dddd7
Compare
producer.go
Outdated
type LastModFunc func(context.Context) (time.Time, error) | ||
|
||
// ProducerState holds current state of producer. | ||
type ProducerState 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.
K, I checked something and it works. There is no need to make ProducerState
public.
- rename to
producerState
- and embed as value not as pointer
type Producer struct {
producerState
// ...
}
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.
here's what I have done to confirm:
// main.go
package main
import "x/internal"
func main() {
x := new(internal.X)
x.Inc()
x.Inc()
println(x.N()) // => 2
}
// internal/types.go
package internal
type X struct {
y
}
type y struct {
n int
}
func (y *y) Inc() {
y.n++
}
func (y *y) N() int {
return y.n
}
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.
hmmm, interesting.
First draft, a couple questions around meta mod times as TODOs. Ended up being more similar to the normal Producer than expected, so might be able to refactor in a follow up.