-
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
bindings: non-nil empty maps/slices are considered as zero values and filtered out from updates #226
Comments
Generic user code is not viable unless libovsdb modelgen includes information about mutability. Or silently filters out inmutable fields. |
If 'nil' is the only way for libovsdb to distinguish 'no change' from 'update', then everything will become a pointer. Does not seem ideal either. I am thinking that mutate -- as you proposed above -- is a more natural approach to explicitly clearing the column. Just a thought. |
related issue: #259 |
@jcaamano I think you could specify the fields you want to be updated/overided explicity when update a row: Line 69 in c6a8f91
|
The idea is to be able to clear out sets or maps in an update. If you provide a non-nil empty slice/map in an update that does not explicitly specify that field, libovsdb will consider it as a default value and filter it out of the update:
libovsdb/ovsdb/bindings.go
Lines 352 to 372 in 586143b
libovsdb/mapper/mapper.go
Lines 152 to 154 in 586143b
The expected behavior was that libovsdb would consider a nil map/slice (the zero value of a slice/map) as a default but not a non-nil empty slice/map and thus that it could be used to clear out the value from DB.
Currently with nbctl you can do something as
<set>=[]
to clear a value out.Alternatives in user code are:
Is there any specific reason why non-nil empty slice/map is considered default instead of just only a nil slice/map?
Could this be changed as the expected behavior described?
How would this affect arrays? Would they need to be changed to pointers?
The text was updated successfully, but these errors were encountered: