From 94ec51d8b53f636d41a879ed1d0d39127168cb21 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 24 Jun 2009 16:40:56 -0400 Subject: Rework transaction code to use tevent_req This is part of a set of patches to rewrite sysdb to a hopefully better API, that will also let use use tevent_req async style calls to manipulate our cache. --- server/db/sysdb_private.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'server/db/sysdb_private.h') diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h index 8c10d9519..d15ec370a 100644 --- a/server/db/sysdb_private.h +++ b/server/db/sysdb_private.h @@ -68,15 +68,36 @@ #include "db/sysdb.h" -struct sysdb_handle; +struct sysdb_handle { + struct sysdb_handle *prev; + struct sysdb_handle *next; + + struct sysdb_ctx *ctx; + struct tevent_req *subreq; + + bool transaction_active; +}; struct sysdb_ctx { struct tevent_context *ev; struct ldb_context *ldb; char *ldb_file; + struct sysdb_handle *queue; }; -bool sysdb_handle_check_running(struct sysdb_handle *handle); +/* An operation blocks the transaction queue as well, but does not + * start a transaction, normally useful only for search type calls. + * do *NOT* call within a transaction you'll deadlock sysdb. + * Also make sure to free the handle as soon as the operation is + * finished to avoid stalling or potentially deadlocking sysdb */ + +struct tevent_req *sysdb_operation_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct sysdb_ctx *ctx); +int sysdb_operation_recv(struct tevent_req *req, TALLOC_CTX *memctx, + struct sysdb_handle **handle); + +void sysdb_operation_done(struct sysdb_handle *handle); #endif /* __INT_SYS_DB_H__ */ -- cgit