diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-06-24 16:40:56 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-07-03 11:07:36 -0400 |
commit | 94ec51d8b53f636d41a879ed1d0d39127168cb21 (patch) | |
tree | e6984ad304bf81781de2b118dac189db4bb0a582 /server/db/sysdb_private.h | |
parent | 6aca93fb4d5d39a100b900a8c297d08629407960 (diff) | |
download | sssd-94ec51d8b53f636d41a879ed1d0d39127168cb21.tar.gz sssd-94ec51d8b53f636d41a879ed1d0d39127168cb21.tar.xz sssd-94ec51d8b53f636d41a879ed1d0d39127168cb21.zip |
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.
Diffstat (limited to 'server/db/sysdb_private.h')
-rw-r--r-- | server/db/sysdb_private.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/server/db/sysdb_private.h b/server/db/sysdb_private.h index 8c10d95..d15ec37 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__ */ |