On Wed, Sep 12, 2012 at 11:45:12AM -0700, Ben Pfaff wrote:
> On Wed, Sep 12, 2012 at 03:17:22PM +0900, Isaku Yamahata wrote:
> > add register_table method to SchemaHelper as counter part of
> > ovsdb_idl_add_table().
> > 
> > Signed-off-by: Isaku Yamahata <[email protected]>
> 
> This seems like a good idea, but would you mind adding a doc comment
> and updating comments on other functions that refer to registration?
> You can start from the comment on ovsdb_idl_add_column().

Here is the updated one.

>From 273a8ddc99ebb60bc45c8f9f9d91cd124676c624 Mon Sep 17 00:00:00 2001
Message-Id: 
<273a8ddc99ebb60bc45c8f9f9d91cd124676c624.1347502637.git.yamah...@valinux.co.jp>
In-Reply-To: <[email protected]>
References: <[email protected]>
From: Isaku Yamahata <[email protected]>
Date: Fri, 24 Aug 2012 15:13:49 +0900
Subject: [PATCH] python/ovs/db/idl: counter part of ovsdb_idl_add_table() to 
SchemaHelper

add register_table method to SchemaHelper as counter part of
ovsdb_idl_add_table().

Signed-off-by: Isaku Yamahata <[email protected]>
---
Changes v1 -> v2:
- doc string
---
 python/ovs/db/idl.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index e4b98e8..5b06d91 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1224,6 +1224,15 @@ class SchemaHelper(object):
         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
@@ -1249,6 +1258,10 @@ class SchemaHelper(object):
         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
-- 
1.7.1.1



-- 
yamahata
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to