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)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Apr 2018 13:05:35 +0000 (15:05 +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 873ebbcab0e58b10ab5d662412c131580627fcb6..31b4a7d9abb4c3e1f2f9856a1aa45a3c910d0258 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 f14666ba88a4e62ff8e2f68ddb0924b9a787eae8..72ebb9713f2f70ebbb20201fe4a79b2ed1107afa 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