diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-10-23 15:24:51 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-10-23 15:24:51 +1100 |
commit | 86d1b4c46582cb0214902cfc5e60b7fe4dc5fdf6 (patch) | |
tree | fb34189a34981163c4d64f07838d846620c2d93c /ctdb/include/ctdb.h | |
parent | c61c65576954d6a21da74ef91d50654b67febf4d (diff) | |
download | samba-86d1b4c46582cb0214902cfc5e60b7fe4dc5fdf6.tar.gz samba-86d1b4c46582cb0214902cfc5e60b7fe4dc5fdf6.tar.xz samba-86d1b4c46582cb0214902cfc5e60b7fe4dc5fdf6.zip |
Add a mechanism where we can register notifications to be sent out to a SRVID when the client disconnects.
The way to use this is from a client to :
1, first create a message handle and bind it to a SRVID
A special prefix for the srvid space has been set aside for samba :
Only samba is allowed to use srvid's with the top 32 bits set like this.
The lower 32 bits are for samba to use internally.
2, register a "notification" using the new control :
CTDB_CONTROL_REGISTER_NOTIFY = 114,
This control takes as indata a structure like this :
struct ctdb_client_notify_register {
uint64_t srvid;
uint32_t len;
uint8_t notify_data[1];
};
srvid is the srvid used in the space set aside above.
len and notify_data is an arbitrary blob.
When notifications are later sent out to all clients, this is the payload of that notification message.
If a client has registered with control 114 and then disconnects from ctdbd, ctdbd will broadcast a message to that srvid to all nodes/listeners in the cluster.
A client can resister itself with as many different srvid's it want, but this is handled through a linked list from the client structure so it mainly designed for "few notifications per client".
3, a client that no longer wants to have a notification set up can deregister using control
CTDB_CONTROL_DEREGISTER_NOTIFY = 115,
which takes this as arguments :
struct ctdb_client_notify_deregister {
uint64_t srvid;
};
When a client deregisters, there will no longer be sent a message to all other clients when this client disconnects from ctdbd.
(This used to be ctdb commit f1b6ee4a55cdca60f93d992f0431d91bf301af2c)
Diffstat (limited to 'ctdb/include/ctdb.h')
-rw-r--r-- | ctdb/include/ctdb.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h index abe09a3f966..1ede66205a2 100644 --- a/ctdb/include/ctdb.h +++ b/ctdb/include/ctdb.h @@ -111,6 +111,10 @@ struct ctdb_call_info { */ #define CTDB_SRVID_TAKEOVER_RUN_RESPONSE 0xFD00000000000000LL +/* A port reserved for samba (top 32 bits) + */ +#define CTDB_SRVID_SAMBA_NOTIFY 0xFE00000000000000LL + /* used on the domain socket, send a pdu to the local daemon */ #define CTDB_CURRENT_NODE 0xF0000001 /* send a broadcast to all nodes in the cluster, active or not */ @@ -144,6 +148,15 @@ struct ctdb_client_control_state { } async; }; +struct ctdb_client_notify_register { + uint64_t srvid; + uint32_t len; + uint8_t notify_data[1]; +}; + +struct ctdb_client_notify_deregister { + uint64_t srvid; +}; struct event_context; |