summaryrefslogtreecommitdiff
path: root/python/ovs/db/idl.py
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-08-23 09:36:39 -0700
committerBen Pfaff <blp@nicira.com>2011-08-24 11:57:43 -0700
commitbf6ec045b7dacb243347a5b84d4c3cff466d6528 (patch)
tree6be0614129324f1540befe20f929240ce9763859 /python/ovs/db/idl.py
parent7d48f8f8bd90922bebbbd46106d8343b2eb1571e (diff)
downloadopenvswitch-bf6ec045b7dacb243347a5b84d4c3cff466d6528.tar.gz
ovs.db.idl: Use top-level class to represent IDL rows.
According to Reid, there may be some disadvantages to having this class be anonymous, for example, cannot do instance/typechecking, might be allocating a new class for every row as well, which isn't the most memory efficient. Suggested-by: Reid Price <reid@nicira.com>
Diffstat (limited to 'python/ovs/db/idl.py')
-rw-r--r--python/ovs/db/idl.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index abb7a444a..dc5f89e69 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -293,8 +293,6 @@ class Idl:
self.data[table_name] = {}
def __create_row(self, table, uuid):
- class Row(object):
- pass
row = self.data[table.name][uuid] = Row()
for column in table.columns.itervalues():
setattr(row, column.name, ovs.db.data.Datum.default(column.type))
@@ -304,3 +302,10 @@ class Idl:
"""Forces the IDL to drop its connection to the database and reconnect.
In the meantime, the contents of the IDL will not change."""
self.session.force_reconnect()
+
+class Row(object):
+ """A row within an Idl. Data for each column is stored as an attribute
+ with the same name as the column and using an ovs.db.data.Datum as the
+ value."""
+ pass
+