summaryrefslogtreecommitdiffstats
path: root/ctdb/include/ctdb.h
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-02-08 15:29:27 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2012-02-08 15:29:27 +1100
commit73f8be16c613a3767c44e29dab9b1d328a04e272 (patch)
tree3f2faf890f71deb76815b5f5dd17480a2527ec45 /ctdb/include/ctdb.h
parent1eafa68f0f3b63dda173d939ed9e4882872b3bea (diff)
downloadsamba-73f8be16c613a3767c44e29dab9b1d328a04e272.tar.gz
samba-73f8be16c613a3767c44e29dab9b1d328a04e272.tar.xz
samba-73f8be16c613a3767c44e29dab9b1d328a04e272.zip
ReadOnly: add per-database statistics to view how much delegations/revokes we have
(This used to be ctdb commit 751ed46197661eb841042ab6a02855a51dd0b17c)
Diffstat (limited to 'ctdb/include/ctdb.h')
-rw-r--r--ctdb/include/ctdb.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h
index 8dbdd47e1e2..93224cbdaa6 100644
--- a/ctdb/include/ctdb.h
+++ b/ctdb/include/ctdb.h
@@ -510,6 +510,39 @@ bool ctdb_getpnn_recv(struct ctdb_connection *ctdb,
/**
+ * ctdb_getdbstat_send - read statistics for a db
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @destnode: the destination node (see below)
+ * @db_id: the database to collect the statistics from
+ * @callback: the callback when ctdb replies to our message (typesafe)
+ * @cbdata: the argument to callback()
+ *
+ * There are several special values for destnode, detailed in
+ * ctdb_protocol.h, particularly CTDB_CURRENT_NODE which means the
+ * local ctdbd.
+ */
+struct ctdb_request *
+ctdb_getdbstat_send(struct ctdb_connection *ctdb,
+ uint32_t destnode,
+ uint32_t db_id,
+ ctdb_callback_t callback,
+ void *cbdata);
+/**
+ * ctdb_getdbstat_recv - read an ctdb_getdbstat reply from ctdbd
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @req: the completed request.
+ * @stat: a pointer to the *stat to fill in
+ *
+ * This returns false if something went wrong, or otherwise fills in **stats
+ * stats must be freed later by calling ctdb_free_dbstat();
+ */
+bool ctdb_getdbstat_recv(struct ctdb_connection *ctdb,
+ struct ctdb_request *req,
+ struct ctdb_db_statistics **stat);
+
+void ctdb_free_dbstat(struct ctdb_db_statistics *stat);
+
+/**
* ctdb_check_message_handlers_send - check a list of message_handlers
* if they are registered
* message_handlers are registered on the daemon using the
@@ -876,6 +909,26 @@ bool ctdb_getpnn(struct ctdb_connection *ctdb,
uint32_t *pnn);
/**
+ * ctdb_getdbstat - read the db stat of a node (synchronous)
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ * @destnode: the destination node (see below)
+ * @db_id: the database to collect the statistics from
+ * @stat: a pointer to the *stat to fill in
+ *
+ * There are several special values for destnode, detailed in
+ * ctdb_protocol.h, particularly CTDB_CURRENT_NODE which means the
+ * local ctdbd.
+ *
+ * This returns false if something went wrong, or otherwise fills in **stat
+ * stat must be freed later by calling ctdb_free_dbstat();
+ */
+bool ctdb_getdbstat(struct ctdb_connection *ctdb,
+ uint32_t destnode,
+ uint32_t db_id,
+ struct ctdb_db_statistics **stat);
+
+
+/**
* ctdb_check_message_handlers - check a list of message_handlers (synchronous)
* @ctdb: the ctdb_connection from ctdb_connect.
* @destnode: the destination node (see below)
@@ -1092,6 +1145,10 @@ void ctdb_free_vnnmap(struct ctdb_vnn_map *vnnmap);
ctdb_getpnn_send((ctdb), (destnode), \
ctdb_sendcb((cb), (cbdata)), (cbdata))
+#define ctdb_getdbstat_send(ctdb, destnode, db_id, cb, cbdata) \
+ ctdb_getdbstat_send((ctdb), (destnode), (db_id), \
+ ctdb_sendcb((cb), (cbdata)), (cbdata))
+
#define ctdb_check_message_handlers_send(ctdb, destnode, num, mhs, \
cb, cbdata) \
ctdb_check_message_handlers_send((ctdb), (destnode), (num), \