[openstack-dev] [Nova] Detect changes in object model
Dan Smith
dms at danplanet.com
Mon Jan 13 15:25:30 UTC 2014
> ObjectListBase has a field called objects that is typed
> fields.ListOfObjectsField('NovaObject'). I can see methods for count
> and index, and I guess you are talking about adding a method for "are
> any of your contents changed" here. I don't see other list operations
> (like append, insert, remove, pop) that modify the list. If these
> were included they would have to mark the list as changed so it is
> picked up when looking for changes.
>
> Do you see these belonging here or would you expect those to go in a
> sub-class if they were wanted?
Well, I've been trying to avoid implying the notion that a list of
things represents the content of the database. Meaning, I don't think it
makes sense for someone to get a list of Foo objects, add another Foo to
the list and then call save() on the list. I think that ends up with the
assumption that the list matches the contents of the database, and if I
add or remove things from the list, I can save() the contents to the
database atomically. That definitely isn't something we can or would
want to support.
That said, if we make the parent object consider the child to be dirty
if any of its contents are dirty or the list itself is dirty (i.e. the
list of objects has changed) that should give us the desired behavior
for change tracking, right?
--Dan
More information about the OpenStack-dev
mailing list