From 39e5faa77c144b0c548d8afe749c1f08438b7e8f Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 20 Mar 2018 11:25:28 +1300 Subject: [PATCH] ldb: make key/value backends expose if there is an active transaction Signed-off-by: Gary Lockyer Signed-off-by: Andrew Bartlett --- lib/ldb/ldb_tdb/ldb_tdb.c | 6 ++++++ lib/ldb/ldb_tdb/ldb_tdb.h | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 873ebbcab0e..31b4a7d9abb 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -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, diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h index f14666ba88a..72ebb9713f2 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/lib/ldb/ldb_tdb/ldb_tdb.h @@ -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 -- 2.47.2