summaryrefslogtreecommitdiffstats
path: root/ctdb/include
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-06-18 15:35:52 +0930
committerRusty Russell <rusty@rustcorp.com.au>2010-06-18 15:35:52 +0930
commitb93e65eaf74ff637bc960356a418ab55f4ca9330 (patch)
tree2d08722c2b2e7e55b84d5a4405b3d881c80e11e0 /ctdb/include
parent3d126e8c1453f29f21ac918b5167753372282aa2 (diff)
libctdb: implement ctdb_disconnect and ctdb_detachdb
These are important for testing, since we can easily tell if we leak memory if there are outstanding allocations after calling these. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 18a212aa40d0ff9ff59775c6fcf9dc973e991460)
Diffstat (limited to 'ctdb/include')
-rw-r--r--ctdb/include/ctdb.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h
index e4aff86723..a9ee63ff25 100644
--- a/ctdb/include/ctdb.h
+++ b/ctdb/include/ctdb.h
@@ -72,7 +72,7 @@ typedef void (*ctdb_log_fn_t)(void *log_priv,
* @log: the logging function
* @log_priv: the private argument to the logging function.
*
- * Returns a ctdb context if successful or NULL. Use ctdb_free() to
+ * Returns a ctdb context if successful or NULL. Use ctdb_disconnect() to
* release the returned ctdb_connection when finished.
*
* See Also:
@@ -100,6 +100,14 @@ void ctdb_log_file(FILE *, int, const char *, va_list);
*/
extern int ctdb_log_level;
+/**
+ * ctdb_disconnect - close down a connection to ctdbd.
+ * @ctdb: the ctdb connectio returned from ctdb_connect.
+ *
+ * The @ctdb arg will be freed by this call, and must not be used again.
+ */
+void ctdb_disconnect(struct ctdb_connection *ctdb);
+
/***
*
* Asynchronous API
@@ -185,7 +193,7 @@ typedef void (*ctdb_callback_t)(struct ctdb_connection *ctdb,
* This represents a particular open database: you receive it from
* ctdb_attachdb or ctdb_attachdb_recv to manipulate a database.
*
- * You have to free the handle with ctdb_detach_db() when finished with it.
+ * You have to free the handle with ctdb_detachdb() when finished with it.
*/
struct ctdb_db;
@@ -457,6 +465,15 @@ struct ctdb_db *ctdb_attachdb(struct ctdb_connection *ctdb,
uint32_t tdb_flags);
/**
+ * ctdb_detachdb - close a clustered TDB.
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @db: the database from ctdb_attachdb/ctdb_attachdb_send
+ *
+ * Closes a clustered tdb.
+ */
+void ctdb_detachdb(struct ctdb_connection *ctdb, struct ctdb_db *db);
+
+/**
* ctdb_readrecordlock - read and lock a record (synchronous)
* @ctdb_db: the database handle from ctdb_attachdb/ctdb_attachdb_recv.
* @key: the key of the record to lock.