diff options
-rw-r--r-- | src/db/sysdb.c | 32 | ||||
-rw-r--r-- | src/db/sysdb.h | 19 |
2 files changed, 37 insertions, 14 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index 2daaa7bc..1f75bbe0 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -669,6 +669,38 @@ void sysdb_transaction_complete(struct tevent_req *subreq) tevent_req_done(req); } +int sysdb_transaction_start(struct sysdb_ctx *ctx) +{ + int ret; + + ret = ldb_transaction_start(ctx->ldb); + if (ret != LDB_SUCCESS) { + DEBUG(1, ("Failed to start ldb transaction! (%d)\n", ret)); + } + return sysdb_error_to_errno(ret); +} + +int sysdb_transaction_commit(struct sysdb_ctx *ctx) +{ + int ret; + + ret = ldb_transaction_commit(ctx->ldb); + if (ret != LDB_SUCCESS) { + DEBUG(1, ("Failed to commit ldb transaction! (%d)\n", ret)); + } + return sysdb_error_to_errno(ret); +} + +int sysdb_transaction_cancel(struct sysdb_ctx *ctx) +{ + int ret; + + ret = ldb_transaction_cancel(ctx->ldb); + if (ret != LDB_SUCCESS) { + DEBUG(1, ("Failed to cancel ldb transaction! (%d)\n", ret)); + } + return sysdb_error_to_errno(ret); +} /* =Operations============================================================ */ diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 6d8e4770..6091e892 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -217,20 +217,11 @@ struct sysdb_ctx *sysdb_handle_get_ctx(struct sysdb_handle *handle); int compare_ldb_dn_comp_num(const void *m1, const void *m2); -/* function to start and finish a transaction - * sysdb_transaction_send() will queue a request for a transaction - * when it is done it will call the tevent_req callback, which must - * retrieve the transaction handle using sysdb_transaction_recv() - * - * A transaction must be completed either by sending a commit: - * sysdb_transaction_commit_send()/sysdb_transaction_commit_recv() - * or by freeing the transaction handle (this will implicitly cause - * a transaction cancelation). - * - * Transactions are serialized, no other transaction or operation can be - * performed while a transaction is active. Multiple transaction request - * are queued internally and served in order. - */ +/* functions to start and finish transactions */ +int sysdb_transaction_start(struct sysdb_ctx *ctx); +int sysdb_transaction_commit(struct sysdb_ctx *ctx); +int sysdb_transaction_cancel(struct sysdb_ctx *ctx); + struct tevent_req *sysdb_transaction_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, |