lib/ovsdb-idl.c
/* Inserts and returns a new row in the table with the specified 'class' in the
 * database with open transaction 'txn'.
 *
 * The new row is assigned a provisional UUID.  If 'uuid' is null then one is
 * randomly generated; otherwise 'uuid' should specify a randomly generated
 * UUID not otherwise in use.  ovsdb-server will assign a different UUID when
 * 'txn' is committed, but the IDL will replace any uses of the provisional
 * UUID in the data to be to be committed by the UUID assigned by
 * ovsdb-server.
 *
 * Usually this function is used indirectly through one of the "insert"
 * functions generated by ovsdb-idlc. */
Inserts and returns a new row in the table with the specified 'class' in the
database with open transaction 'txn'.

The new row is assigned a provisional UUID.  If 'uuid' is null then one is
randomly generated; otherwise 'uuid' should specify a randomly generated
UUID not otherwise in use.  ovsdb-server will assign a different UUID when
'txn' is committed, but the IDL will replace any uses of the provisional
UUID in the data to be to be committed by the UUID assigned by
ovsdb-server.

Usually this function is used indirectly through one of the "insert"
functions generated by ovsdb-idlc.
Inserts and returns a new row in the table with the specified ' class ' in the database with open transaction ' txn ' . The new row is assigned a provisional UUID . If ' uuid ' is null then one is randomly generated ; otherwise ' uuid ' should specify a randomly generated UUID not otherwise in use . ovsdb - server will assign a different UUID when ' txn ' is committed but the IDL will replace any uses of the provisional UUID in the data to be to be committed by the UUID assigned by ovsdb - server . Usually this function is used indirectly through one of the " insert " functions generated by ovsdb - idlc .
const struct ovsdb_idl_row *
ovsdb_idl_txn_insert(struct ovsdb_idl_txn *txn,
                     const struct ovsdb_idl_table_class *class,
                     const struct uuid *uuid)
{
    struct ovsdb_idl_row *row = ovsdb_idl_row_create__(class);
    if (uuid) {
        ovs_assert(!ovsdb_idl_txn_get_row(txn, uuid));
        row->uuid = *uuid;
    } else {
        uuid_generate(&row->uuid);
    }
    row->table = ovsdb_idl_db_table_from_class(txn->db, class);
    row->new_datum = xmalloc(class->n_columns * sizeof *row->new_datum);
    hmap_insert(&row->table->rows, &row->hmap_node, uuid_hash(&row->uuid));
    hmap_insert(&txn->txn_rows, &row->txn_node, uuid_hash(&row->uuid));
    ovsdb_idl_add_to_indexes(row);
    return row;
}
const struct ovsdb_idl_row * ovsdb_idl_txn_insert ( struct ovsdb_idl_txn * txn , const struct ovsdb_idl_table_class * class , const struct uuid * uuid ) { struct ovsdb_idl_row * row = ovsdb_idl_row_create__ ( class ) ; if ( uuid ) { ovs_assert ( ! ovsdb_idl_txn_get_row ( txn , uuid ) ) ; row -> uuid = * uuid ; } else { uuid_generate ( & row -> uuid ) ; } row -> table = ovsdb_idl_db_table_from_class ( txn -> db , class ) ; row -> new_datum = xmalloc ( class -> n_columns * sizeof * row -> new_datum ) ; hmap_insert ( & row -> table -> rows , & row -> hmap_node , uuid_hash ( & row -> uuid ) ) ; hmap_insert ( & txn -> txn_rows , & row -> txn_node , uuid_hash ( & row -> uuid ) ) ; ovsdb_idl_add_to_indexes ( row ) ; return row ; }
Inserts and returns a new row in the table with the specified 'class' in the
 database with open transaction 'txn'.
Inserts and returns a new row in the table with the specified ' class ' in the database with open transaction ' txn ' .