ldb: make key/value backends expose if there is an active transaction
authorGary Lockyer <gary@catalyst.net.nz>
Mon, 19 Mar 2018 22:25:28 +0000 (11:25 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 3 May 2018 06:17:44 +0000 (08:17 +0200)
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_tdb/ldb_tdb.c
lib/ldb/ldb_tdb/ldb_tdb.h

index 873ebbc..31b4a7d 100644 (file)
@@ -1925,6 +1925,11 @@ static bool ltdb_tdb_changed(struct ltdb_private *ltdb)
        return has_changed;
 }
 
+static bool ltdb_transaction_active(struct ltdb_private *ltdb)
+{
+       return tdb_transaction_active(ltdb->tdb);
+}
+
 static const struct kv_db_ops key_value_ops = {
        .store = ltdb_tdb_store,
        .delete = ltdb_tdb_delete,
@@ -1941,6 +1946,7 @@ static const struct kv_db_ops key_value_ops = {
        .errorstr = ltdb_errorstr,
        .name = ltdb_tdb_name,
        .has_changed = ltdb_tdb_changed,
+       .transaction_active = ltdb_transaction_active,
 };
 
 static void ltdb_callback(struct tevent_context *ev,
index f14666b..72ebb97 100644 (file)
@@ -29,6 +29,7 @@ struct kv_db_ops {
        const char * (*errorstr)(struct ltdb_private *ltdb);
        const char * (*name)(struct ltdb_private *ltdb);
        bool (*has_changed)(struct ltdb_private *ltdb);
+       bool (*transaction_active)(struct ltdb_private *ltdb);
 };
 
 /* this private structure is used by the ltdb backend in the