diff options
author | Ben Pfaff <blp@nicira.com> | 2010-01-25 10:15:17 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-01-26 09:49:30 -0800 |
commit | 979821c0a6b0c8a9f941a2e13c49feffe2391ab8 (patch) | |
tree | ea54fde91e9ff44137a2355df1f47aef4067623a /lib/ovsdb-idl.h | |
parent | 36d802ae1fd61d5ae3bfa1b114b8f3a911d987e5 (diff) |
ovsdb-idl: Allow clients to modify records without using structs.
The IDL is intended to allow clients easier access to data in the database
by providing an extra layer of abstraction. However, ovs-vsctl needs to
also provide generic access to database tables, rows, and columns, and
until now the IDL has not allowed this. In particular, there was no way
to modify the value of a database column by providing a "struct
ovsdb_datum" with the new value and then have that reflected in the IDL
structs, although the other direction was possible.
This commit fixes that problem, which requires a bit of refactoring of the
IDL layer. It also exposes the interface for iterating through table
records to clients directly, by moving it from the "private" IDL header to
the public one.
Diffstat (limited to 'lib/ovsdb-idl.h')
-rw-r--r-- | lib/ovsdb-idl.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index 88514b94..975dfc17 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009 Nicira Networks. +/* Copyright (c) 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,11 @@ #include <stdint.h> struct json; +struct ovsdb_datum; struct ovsdb_idl_class; +struct ovsdb_idl_column; +struct ovsdb_idl_table_class; +struct uuid; struct ovsdb_idl *ovsdb_idl_create(const char *remote, const struct ovsdb_idl_class *); @@ -33,6 +37,13 @@ unsigned int ovsdb_idl_get_seqno(const struct ovsdb_idl *); bool ovsdb_idl_has_ever_connected(const struct ovsdb_idl *); void ovsdb_idl_force_reconnect(struct ovsdb_idl *); +const struct ovsdb_idl_row *ovsdb_idl_get_row_for_uuid( + const struct ovsdb_idl *, const struct ovsdb_idl_table_class *, + const struct uuid *); +const struct ovsdb_idl_row *ovsdb_idl_first_row( + const struct ovsdb_idl *, const struct ovsdb_idl_table_class *); +const struct ovsdb_idl_row *ovsdb_idl_next_row(const struct ovsdb_idl_row *); + enum ovsdb_idl_txn_status { TXN_UNCHANGED, /* Transaction didn't include any changes. */ TXN_INCOMPLETE, /* Commit in progress, please wait. */ @@ -57,4 +68,11 @@ enum ovsdb_idl_txn_status ovsdb_idl_txn_commit(struct ovsdb_idl_txn *); int64_t ovsdb_idl_txn_get_increment_new_value(const struct ovsdb_idl_txn *); void ovsdb_idl_txn_abort(struct ovsdb_idl_txn *); +void ovsdb_idl_txn_read(const struct ovsdb_idl_row *, + const struct ovsdb_idl_column *, + struct ovsdb_datum *); +void ovsdb_idl_txn_write(const struct ovsdb_idl_row *, + const struct ovsdb_idl_column *, + struct ovsdb_datum *); + #endif /* ovsdb-idl.h */ |