summaryrefslogtreecommitdiff
path: root/ovsdb/row.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-03-15 15:41:54 -0700
committerBen Pfaff <blp@nicira.com>2010-03-17 14:24:56 -0700
commit7360012bdf64effd898242a58634267e203a2795 (patch)
tree8f49d0007ef10c3fadc14bf2789c8df5c307d1a6 /ovsdb/row.h
parent17d18afbfd65619e830d551cb002441519cde059 (diff)
downloadopenvswitch-7360012bdf64effd898242a58634267e203a2795.tar.gz
ovsdb: Add support for weak references.
Diffstat (limited to 'ovsdb/row.h')
-rw-r--r--ovsdb/row.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/ovsdb/row.h b/ovsdb/row.h
index 302f61ab1..6c249a184 100644
--- a/ovsdb/row.h
+++ b/ovsdb/row.h
@@ -20,20 +20,42 @@
#include <stdint.h>
#include "column.h"
#include "hmap.h"
+#include "list.h"
#include "ovsdb-data.h"
struct ovsdb_column_set;
+/* A weak reference.
+ *
+ * When a column in row A contains a weak reference to UUID of a row B this
+ * constitutes a weak reference from A (the source) to B (the destination).
+ *
+ * Rows A and B may be in the same table or different tables.
+ *
+ * Weak references from a row to itself are allowed, but no "struct
+ * ovsdb_weak_ref" structures are created for them.
+ */
+struct ovsdb_weak_ref {
+ struct list src_node; /* In src->src_refs list. */
+ struct list dst_node; /* In destination row's dst_refs list. */
+ struct ovsdb_row *src; /* Source row. */
+};
+
/* A row in a database table. */
struct ovsdb_row {
- struct ovsdb_table *table; /* Table to which this belongs. */
- struct hmap_node hmap_node; /* Element in ovsdb_table's 'rows' hmap. */
+ struct ovsdb_table *table; /* Table to which this belongs. */
+ struct hmap_node hmap_node; /* Element in ovsdb_table's 'rows' hmap. */
struct ovsdb_txn_row *txn_row; /* Transaction that row is in, if any. */
- /* Number of refs to this row from other rows, in this table or other
- * tables, through 'uuid' columns that have a 'refTable' constraint
- * pointing to this table. A row with nonzero 'n_refs' cannot be deleted.
- * Updated and checked only at transaction commit. */
+ /* Weak references. */
+ struct list src_refs; /* Weak references from this row. */
+ struct list dst_refs; /* Weak references to this row. */
+
+ /* Number of strong refs to this row from other rows, in this table or
+ * other tables, through 'uuid' columns that have a 'refTable' constraint
+ * pointing to this table and a 'refType' of "strong". A row with nonzero
+ * 'n_refs' cannot be deleted. Updated and checked only at transaction
+ * commit. */
size_t n_refs;
struct ovsdb_datum fields[];