-void
-ovsdb_txn_commit(struct ovsdb_txn *txn)
-{
- txn->db->run_triggers = true;
- ovsdb_txn_destroy(txn, ovsdb_txn_row_commit);
-}
-
-static void
-put_json_column(struct json *object, const struct ovsdb_row *row,
- const struct ovsdb_column *column)
-{
- json_object_put(object, column->name,
- ovsdb_datum_to_json(&row->fields[column->index],
- &column->type));
-}
-
-static struct json *
-ovsdb_txn_row_to_json(const struct ovsdb_txn_row *txn_row)
-{
- const struct ovsdb_row *old = txn_row->old;
- const struct ovsdb_row *new = txn_row->new;
- struct shash_node *node;
- struct json *json;
-
- if (!new) {
- return json_null_create();
- }
-
- json = NULL;
- SHASH_FOR_EACH (node, &new->table->schema->columns) {
- struct ovsdb_column *column = node->data;
- unsigned int index = column->index;
-
- if (index != OVSDB_COL_UUID && column->persistent
- && (!old || !ovsdb_datum_equals(&old->fields[index],
- &new->fields[index],
- &column->type)))
- {
- if (!json) {
- json = json_object_create();
- }
- put_json_column(json, new, column);
- }
- }
- return json;
-}
-
-static struct json *
-ovsdb_txn_table_to_json(const struct ovsdb_txn_table *txn_table)
-{
- struct ovsdb_txn_row *txn_row;
- struct json *txn_table_json;
-
- txn_table_json = NULL;
- HMAP_FOR_EACH (txn_row, struct ovsdb_txn_row, hmap_node,
- &txn_table->txn_rows) {
- struct json *txn_row_json = ovsdb_txn_row_to_json(txn_row);
- if (txn_row_json) {
- char uuid[UUID_LEN + 1];
-
- if (!txn_table_json) {
- txn_table_json = json_object_create();
- }
-
- snprintf(uuid, sizeof uuid,
- UUID_FMT, UUID_ARGS(ovsdb_txn_row_get_uuid(txn_row)));
- json_object_put(txn_table_json, uuid, txn_row_json);
- }
- }
- return txn_table_json;
-}
-
-struct json *
-ovsdb_txn_to_json(const struct ovsdb_txn *txn)
-{
- struct ovsdb_txn_table *txn_table;
- struct json *txn_json;
-
- txn_json = NULL;
- HMAP_FOR_EACH (txn_table, struct ovsdb_txn_table, hmap_node,
- &txn->txn_tables) {
- struct json *txn_table_json = ovsdb_txn_table_to_json(txn_table);
- if (!txn_json) {
- txn_json = json_object_create();
- }
- json_object_put(txn_json, txn_table->table->schema->name,
- txn_table_json);
- }
- return txn_json;
-}
-
-static struct ovsdb_error *
-ovsdb_txn_row_from_json(struct ovsdb_txn *txn, struct ovsdb_table *table,
- const struct uuid *row_uuid, struct json *json)