char *error;
bool dry_run;
struct ds comment;
- unsigned int commit_seqno;
/* Increments. */
const char *inc_table;
* 'class'. (Ordinarily 'class' is compiled from an OVSDB schema automatically
* by ovsdb-idlc.)
*
+ * Passes 'retry' to jsonrpc_session_open(). See that function for
+ * documentation.
+ *
* If 'monitor_everything_by_default' is true, then everything in the remote
* database will be replicated by default. ovsdb_idl_omit() and
* ovsdb_idl_omit_alert() may be used to selectively drop some columns from
*/
struct ovsdb_idl *
ovsdb_idl_create(const char *remote, const struct ovsdb_idl_class *class,
- bool monitor_everything_by_default)
+ bool monitor_everything_by_default, bool retry)
{
struct ovsdb_idl *idl;
uint8_t default_mode;
idl = xzalloc(sizeof *idl);
idl->class = class;
- idl->session = jsonrpc_session_open(remote);
+ idl->session = jsonrpc_session_open(remote, retry);
shash_init(&idl->table_by_name);
idl->tables = xmalloc(class->n_tables * sizeof *idl->tables);
for (i = 0; i < class->n_tables; i++) {
&& !strcmp(msg->method, "stolen")) {
/* Someone else stole our lock. */
ovsdb_idl_parse_lock_notify(idl, msg->params, false);
- } else if (msg->type == JSONRPC_REPLY && msg->id->type == JSON_STRING
- && !strcmp(msg->id->u.string, "echo")) {
- /* Reply to our echo request. Ignore it. */
} else if ((msg->type == JSONRPC_ERROR
|| msg->type == JSONRPC_REPLY)
&& ovsdb_idl_txn_process_reply(idl, msg)) {
return ovsdb_idl_get_seqno(idl) != 0;
}
+/* Reconfigures 'idl' so that it would reconnect to the database, if
+ * connection was dropped. */
+void
+ovsdb_idl_enable_reconnect(struct ovsdb_idl *idl)
+{
+ jsonrpc_session_enable_reconnect(idl->session);
+}
+
/* Forces 'idl' to drop its connection to the database and reconnect. In the
* meantime, the contents of 'idl' will not change. */
void
{
idl->verify_write_only = true;
}
+
+bool
+ovsdb_idl_is_alive(const struct ovsdb_idl *idl)
+{
+ return jsonrpc_session_is_alive(idl->session);
+}
+
+int
+ovsdb_idl_get_last_error(const struct ovsdb_idl *idl)
+{
+ return jsonrpc_session_get_last_error(idl->session);
+}
\f
static unsigned char *
ovsdb_idl_get_mode(struct ovsdb_idl *idl,
}
}
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
static void
}
}
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
/* Turns off OVSDB_IDL_ALERT for 'column' in 'idl'.
txn->error = NULL;
txn->dry_run = false;
ds_init(&txn->comment);
- txn->commit_seqno = txn->idl->change_seqno;
txn->inc_table = NULL;
txn->inc_column = NULL;
if (txn->inc_index + 2 > results->n) {
VLOG_WARN_RL(&syntax_rl, "reply does not contain enough operations "
- "for increment (has %zu, needs %u)",
+ "for increment (has %"PRIuSIZE", needs %u)",
results->n, txn->inc_index + 2);
return false;
}
return false;
}
if (rows->u.array.n != 1) {
- VLOG_WARN_RL(&syntax_rl, "\"select\" reply \"rows\" has %zu elements "
+ VLOG_WARN_RL(&syntax_rl, "\"select\" reply \"rows\" has %"PRIuSIZE" elements "
"instead of 1",
rows->u.array.n);
return false;
if (insert->op_index >= results->n) {
VLOG_WARN_RL(&syntax_rl, "reply does not contain enough operations "
- "for insert (has %zu, needs %u)",
+ "for insert (has %"PRIuSIZE", needs %u)",
results->n, insert->op_index);
return false;
}