diff options
author | Ben Pfaff <blp@nicira.com> | 2010-06-16 14:35:48 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-07-12 10:13:53 -0700 |
commit | 8c3c2f30007534ced8dc6030ecc60d52c3333be4 (patch) | |
tree | f791799fd72123387f37683885d045735ded17bf /lib/ovsdb-idl.h | |
parent | a1ec42a39c4a58ad7d67699900514b8d62f8d792 (diff) |
ovsdb-idl: Transition to better interfaces for reading table columns.
The existing ovsdb_idl_txn_read() was somewhat difficult and expensive to
use, because it always made a copy of the data in the column. This was
necessary at the time it was introduced, because there was no way for it
to return a "default" value for columns that had not yet been populated
without allocating data and hence requiring the caller to free it.
Now that ovsdb_datum_default() exists, this is no longer required. This
commit introduces a pair of new functions, ovsdb_idl_read() and
ovsdb_idl_get(), that return a pointer to existing data and do not do any
copying. It also transitions all of ovsdb_idl_txn_read()'s callers to
the new interfaces.
Diffstat (limited to 'lib/ovsdb-idl.h')
-rw-r--r-- | lib/ovsdb-idl.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h index 7832e4ee..c09ba9b0 100644 --- a/lib/ovsdb-idl.h +++ b/lib/ovsdb-idl.h @@ -33,6 +33,7 @@ #include <stdbool.h> #include <stdint.h> #include "compiler.h" +#include "ovsdb-types.h" struct json; struct ovsdb_datum; @@ -59,6 +60,13 @@ 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 *); +const struct ovsdb_datum *ovsdb_idl_read(const struct ovsdb_idl_row *, + const struct ovsdb_idl_column *); +const struct ovsdb_datum *ovsdb_idl_get(const struct ovsdb_idl_row *, + const struct ovsdb_idl_column *, + enum ovsdb_atomic_type key_type, + enum ovsdb_atomic_type value_type); + enum ovsdb_idl_txn_status { TXN_UNCHANGED, /* Transaction didn't include any changes. */ TXN_INCOMPLETE, /* Commit in progress, please wait. */ @@ -90,9 +98,6 @@ int64_t ovsdb_idl_txn_get_increment_new_value(const struct ovsdb_idl_txn *); const struct uuid *ovsdb_idl_txn_get_insert_uuid(const struct ovsdb_idl_txn *, const struct uuid *); -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 *); |