-
Notifications
You must be signed in to change notification settings - Fork 154
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
Model-based Monitor API #158
Conversation
Pull Request Test Coverage Report for Build 936990382
💛 - Coveralls |
Thanks for the comments @halfcrazy. All addressed. |
Specifying a custom Monitor is harder now we have models as it requires the user to know the names of the Table and Fields they are interested in. We already have this data in the model. This commit changes the API to make it easier. For example: ``` err = ovs.Monitor("play_with_ovs", ovs.NewTableMonitor(&OpenvSwitch{}), ovs.NewTableMonitor(&Bridge{}), ) ``` You can optionally provide pointers to the fields in a model to monitor only those columns. Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
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 a couple of nits. Otherwise LGTM
columns = append(columns, column) | ||
} | ||
} else { | ||
for c := range info.table.Columns { |
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.
nit: I think empty columns stand for "all" columns
@@ -254,18 +257,11 @@ func (ovs OvsdbClient) Transact(operation ...ovsdb.Operation) ([]ovsdb.Operation | |||
|
|||
// MonitorAll is a convenience method to monitor every table/column | |||
func (ovs OvsdbClient) MonitorAll(jsonContext 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.
I'm wondering if MonitorAll
could just be replaced by Monitor
with no options...
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 could. And I think we can address that in a follow up that deprecates MonitorAll
entirely.
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.
Specifying a custom Monitor is harder now we have models as it requires
the user to know the names of the Table and Fields they are interested
in. We already have this data in the model.
This commit changes the API to make it easier.
For example:
You can optionally provide pointers to the fields in a model to monitor
only those columns.
Signed-off-by: Dave Tucker dave@dtucker.co.uk