-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Watch delivers current state for resourceVersion=0 #852
Watch delivers current state for resourceVersion=0 #852
Conversation
|
||
// WatchAndTransform begins watching the specified key. Events are decoded into | ||
// API objects and sent down the returned watch.Interface. If the transform | ||
// function is provided, the value decoded from etcd will be passed to the function |
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.
just to be a pain - what is the transform function signature, and what is it supposed to do? Maybe a (textual) example?
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.
Woops, signature is just below. Still a bit more on the intended use would help
LGTM overall - need a second LG |
go w.etcdWatch(h.Client, key, resourceVersion) | ||
return w, nil | ||
} | ||
|
||
// TransformFunc attempts to convert an object to another object for use with a watcher | ||
type TransformFunc func(interface{}) (interface{}, 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.
It occurs to me now that TransformFunc and my own FilterFunc are actually better applied as a separate, layered watch.
e.g., in the watch package, func Filter(w Interface, f FilterFunc) Interface
and func Transform(w Interface, f TransformFunc) Interface
. Or they could even be combined, with FilterFunc returning the new object and whether to send it.
I can do that in another PR if you don't want to do it 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.
Agree - maybe follow on pull?
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.
Sure.
I think sendResult is not going to work with a list of nodes, which I think is what a recursive Get will return. Can you test that case, please? |
Yeah - or just don't offer the functionality on recursive Get? |
@smarterclayton: No I think the functionality is extremely important-- imagine a replicationController rebooting. That's broken right now without this. |
Working on it. |
ptal |
} | ||
copied := *response | ||
copied.Node = node | ||
glog.Infof("queueing change %#v", copied) |
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.
Remove or move to a V(x) log?
Allows clients to get the current state without having to execute a get followed by a watch. Makes integration with action loops much cleaner.
LGTM |
Watch delivers current state for resourceVersion=0
Modify generic collector
Update node self-labeling implementation timeline
UPSTREAM: <carry>: add a way to inject a vulnerable, legacy service-c…
Allows clients to get the current state without having to execute
a get followed by a watch. Makes integration with action loops
much cleaner.
Split from #846