Skip to content

Commit

Permalink
python/ovs/db/idl: add counterpart of ovsdb_idl_add_table()
Browse files Browse the repository at this point in the history
Add register_table method to SchemaHelper as Python counterpart of
ovsdb_idl_add_table() in the C version of the IDL.

Signed-off-by: Isaku Yamahata <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
Isaku Yamahata authored and blp committed Sep 13, 2012
1 parent 6d3c5b6 commit 7698e31
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/ovs/db/idl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,15 @@ def register_columns(self, table, columns):
columns = set(columns) | self._tables.get(table, set())
self._tables[table] = columns

def register_table(self, table):
"""Registers interest in the given all columns of 'table'. Future calls
to get_idl_schema() will include all columns of 'table'.
'table' must be a string
"""
assert type(table) is str
self._tables[table] = set() # empty set means all columns in the table

def register_all(self):
"""Registers interest in every column of every table."""
self._all = True
Expand All @@ -1249,6 +1258,10 @@ def _keep_table_columns(self, schema, table_name, columns):
assert table_name in schema.tables
table = schema.tables[table_name]

if not columns:
# empty set means all columns in the table
return table

new_columns = {}
for column_name in columns:
assert type(column_name) is str
Expand Down

0 comments on commit 7698e31

Please sign in to comment.