+ void *ftxn_)
+{
+ struct ovsdb_file_txn *ftxn = ftxn_;
+ ovsdb_file_txn_add_row(ftxn, old, new);
+ return true;
+}
+
+static struct ovsdb_error *
+ovsdb_file_replica_commit(struct ovsdb_replica *r_,
+ const struct ovsdb_txn *txn, bool durable)
+{
+ struct ovsdb_file_replica *r = ovsdb_file_replica_cast(r_);
+ struct ovsdb_file_txn ftxn;
+
+ ovsdb_file_txn_init(&ftxn);
+ ovsdb_txn_for_each_change(txn, ovsdb_file_replica_change_cb, &ftxn);
+ if (!ftxn.json) {
+ /* Nothing to commit. */
+ return NULL;
+ }
+
+ return ovsdb_file_txn_commit(ftxn.json, ovsdb_txn_get_comment(txn),
+ durable, r->log);
+}
+
+static void
+ovsdb_file_replica_destroy(struct ovsdb_replica *r_)
+{
+ struct ovsdb_file_replica *r = ovsdb_file_replica_cast(r_);
+
+ ovsdb_log_close(r->log);
+ free(r);
+}
+
+static const struct ovsdb_replica_class ovsdb_file_replica_class = {
+ ovsdb_file_replica_commit,
+ ovsdb_file_replica_destroy
+};
+\f
+static void
+ovsdb_file_txn_init(struct ovsdb_file_txn *ftxn)
+{
+ ftxn->json = NULL;
+ ftxn->table_json = NULL;
+ ftxn->table = NULL;
+}
+
+static void
+ovsdb_file_txn_add_row(struct ovsdb_file_txn *ftxn,
+ const struct ovsdb_row *old,
+ const struct ovsdb_row *new)