aboutsummaryrefslogtreecommitdiff
path: root/lib/ovsdb-idl-provider.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-08-11 15:41:41 -0700
committerBen Pfaff <blp@nicira.com>2010-08-11 15:41:41 -0700
commitc547535a7c25ce4717b965b77877062796f12a95 (patch)
treeef5d1b34e7decd274c269bcb8ea27eeabe773066 /lib/ovsdb-idl-provider.h
parentf2f7be8696e030dbe6f7c859c4e2bd76fd363036 (diff)
ovsdb-idl: Make it possible to omit or pay less attention to columns.
ovs-vswitchd has no need to replicate some parts of the database. In particular, it doesn't need to replicate the bits that it never reads, such as the external_ids column in the Open_vSwitch table. This saves some memory, CPU time, and bandwidth to the database. Another type of column that benefits from special treatment is "write-only columns", that is, those that ovs-vswitchd writes and keeps up-to-date but never expects another client to write, such as the cur_cfg column in the Open_vSwitch table. If the IDL reports that the database has changed when ovs-vswitchd updates such a column, then ovs-vswitchd reconfigures itself for no reason, wasting CPU time. This commit also adds support for such columns.
Diffstat (limited to 'lib/ovsdb-idl-provider.h')
-rw-r--r--lib/ovsdb-idl-provider.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index c86396c9..040a6999 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -52,8 +52,31 @@ struct ovsdb_idl_table_class {
size_t allocation_size;
};
+enum ovsdb_idl_mode {
+ /* Client reads and may write this column and wants to be alerted upon
+ * updates to it.
+ *
+ * This is the default. */
+ OVSDB_IDL_MODE_RW,
+
+ /* Client may read and write this column, but doesn't care to be alerted
+ * when it is updated.
+ *
+ * This is useful for columns that a client treats as "write-only", that
+ * is, it updates them but doesn't want to get alerted about its own
+ * updates. It also won't be alerted about other clients' updates, so this
+ * is suitable only for use by a client that "owns" a particular column. */
+ OVSDB_IDL_MODE_WO,
+
+ /* Client won't read or write this column at all. The IDL code can't
+ * prevent reading the column, but writing will cause assertion
+ * failures. */
+ OVSDB_IDL_MODE_NONE
+};
+
struct ovsdb_idl_table {
const struct ovsdb_idl_table_class *class;
+ unsigned char *modes; /* One of OVSDB_MODE_*, indexed by column. */
struct shash columns; /* Contains "const struct ovsdb_idl_column *"s. */
struct hmap rows; /* Contains "struct ovsdb_idl_row"s. */
struct ovsdb_idl *idl; /* Containing idl. */