#include <assert.h>
+#include "dynamic-string.h"
#include "hash.h"
#include "hmap.h"
#include "json.h"
struct ovsdb_txn {
struct ovsdb *db;
struct hmap txn_tables; /* Contains "struct ovsdb_txn_table"s. */
+ struct ds comment;
};
/* A table modified by a transaction. */
struct ovsdb_txn *txn = xmalloc(sizeof *txn);
txn->db = db;
hmap_init(&txn->txn_tables);
+ ds_init(&txn->comment);
return txn;
}
free(txn_table);
}
hmap_destroy(&txn->txn_tables);
+ ds_destroy(&txn->comment);
free(txn);
}
ovsdb_row_destroy(row);
}
}
+
+void
+ovsdb_txn_add_comment(struct ovsdb_txn *txn, const char *s)
+{
+ if (txn->comment.length) {
+ ds_put_char(&txn->comment, '\n');
+ }
+ ds_put_cstr(&txn->comment, s);
+}
+
+const char *
+ovsdb_txn_get_comment(const struct ovsdb_txn *txn)
+{
+ return txn->comment.length ? ds_cstr_ro(&txn->comment) : NULL;
+}