-
Notifications
You must be signed in to change notification settings - Fork 11
Handle deletion events from watch and purge deleted entries. #62
Conversation
| constexpr const int kMetadataApiDefaultPort = 8000; | ||
| constexpr const char kMetadataApiDefaultResourceTypeSeparator[] = "."; | ||
| constexpr const int kMetadataReporterDefaultIntervalSeconds = 60; | ||
| constexpr const int kMetadataReporterDefaultPurgeDeleted = false; |
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.
Should we be defaulting to true?
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 rather put this through a few more tests. It can be overridden in the config map if necessary.
| }; | ||
|
|
||
| if (container_status) { | ||
| if (container_status && container_status->Has("containerID")) { |
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 was this added? Do we directly depend on this property anywhere?
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.
Yes, right below. The deletion events apparently had a status without a container id.
| std::unique_lock<std::mutex> watch_completion(completion_mutex); | ||
| Watcher watcher(callback, std::move(watch_completion), | ||
| config_.VerboseLogging()); | ||
| Watcher watcher(std::bind(&EventCallback, callback, std::placeholders::_1), |
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.
std::placeholders::_N leaves me a bit puzzled. Is there a way of doing these methods without using unbound arguments?
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.
They confuse me too. Unfortunately, there is no better way.
If it helps, think about std::bind as: you have to list all of the arguments to the bound function, but some of those can represent the arguments to the function being called -- that's what placeholders are (std::placeholders::_1 is the first argument to the resulting function).
igorpeshansky
left a 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.
Thanks for the review. PTAL.
| constexpr const int kMetadataApiDefaultPort = 8000; | ||
| constexpr const char kMetadataApiDefaultResourceTypeSeparator[] = "."; | ||
| constexpr const int kMetadataReporterDefaultIntervalSeconds = 60; | ||
| constexpr const int kMetadataReporterDefaultPurgeDeleted = false; |
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 rather put this through a few more tests. It can be overridden in the config map if necessary.
| }; | ||
|
|
||
| if (container_status) { | ||
| if (container_status && container_status->Has("containerID")) { |
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.
Yes, right below. The deletion events apparently had a status without a container id.
| std::unique_lock<std::mutex> watch_completion(completion_mutex); | ||
| Watcher watcher(callback, std::move(watch_completion), | ||
| config_.VerboseLogging()); | ||
| Watcher watcher(std::bind(&EventCallback, callback, std::placeholders::_1), |
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.
They confuse me too. Unfortunately, there is no better way.
If it helps, think about std::bind as: you have to list all of the arguments to the bound function, but some of those can represent the arguments to the function being called -- that's what placeholders are (std::placeholders::_1 is the first argument to the resulting function).
supriyagarg
left a 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.
LGTM
bmoyles0117
left a 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.
LGTM
4d3eadd to
9c46711
Compare
|
Rebased off |
bmoyles0117
left a 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.
LGTM ![]()
Also a minor refactoring of the watch code.