ctdb: Rename CTDB_VERSION to CTDB_PROTOCOL
[obnox/samba/samba-obnox.git] / ctdb / include / ctdb_protocol.h
index 3133b4e6d916c0916a6008267a6656bbedb5cfa3..725e42623006120b9bed19a0aa78416a6b7b625c 100644 (file)
@@ -22,9 +22,9 @@
 
 /* location of daemon socket, set at configure time */
 #ifdef SOCKPATH
-#define CTDB_PATH      SOCKPATH
+#define CTDB_SOCKET    SOCKPATH
 #else
-#define CTDB_PATH      "/tmp/ctdb.socket"
+#define CTDB_SOCKET    "/var/run/ctdb/ctdbd.socket"
 #endif
 
 /* default ctdb port number */
@@ -113,6 +113,10 @@ struct ctdb_call_info {
  */
 #define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
 
+/*
+ * a message to tell recovery daemon to detach a database
+ */
+#define CTDB_SRVID_DETACH_DATABASE 0xF701000000000000LL
 /*
   a message to tell the recovery daemon to write a talloc memdump
   to the log
@@ -147,10 +151,8 @@ struct ctdb_call_info {
 */
 #define CTDB_SRVID_REBALANCE_NODE 0xFB01000000000000LL
 
-/*
-   a message handler ID meaning to ask recovery master to reload all ips
- */
-#define CTDB_SRVID_RELOAD_ALL_IPS 0xFB02000000000000LL
+/* A message handler ID to stop takeover runs from occurring */
+#define CTDB_SRVID_DISABLE_TAKEOVER_RUNS 0xFB03000000000000LL
 
 /* A message id to ask the recovery daemon to temporarily disable the
    public ip checks
@@ -242,9 +244,9 @@ enum ctdb_eventscript_call {
        CTDB_EVENT_RELEASE_IP,          /* IP released: interface, IP address, netmask bits. */
        CTDB_EVENT_STOPPED,             /* Deprecated, do not use. */
        CTDB_EVENT_MONITOR,             /* Please check if service is healthy: no args. */
-       CTDB_EVENT_STATUS,              /* Report service status: no args. */
+       CTDB_EVENT_STATUS,              /* Deprecated, do not use. */
        CTDB_EVENT_SHUTDOWN,            /* CTDB shutting down: no args. */
-       CTDB_EVENT_RELOAD,              /* magic */
+       CTDB_EVENT_RELOAD,              /* Deprecated, do not use */
        CTDB_EVENT_UPDATE_IP,           /* IP updating: old interface, new interface, IP address, netmask bits. */
        CTDB_EVENT_IPREALLOCATED,       /* when a takeover_run() completes */
        CTDB_EVENT_MAX
@@ -270,7 +272,7 @@ enum ctdb_operation {
 };
 
 #define CTDB_MAGIC 0x43544442 /* CTDB */
-#define CTDB_VERSION 1
+#define CTDB_PROTOCOL 1
 
 enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_STATISTICS              = 1,
@@ -334,7 +336,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_CHECK_SERVER_ID         = 59,
                    CTDB_CONTROL_GET_SERVER_ID_LIST      = 60,
                    CTDB_CONTROL_DB_ATTACH_PERSISTENT    = 61,
-                   CTDB_CONTROL_PERSISTENT_STORE        = 62,
+                   CTDB_CONTROL_PERSISTENT_STORE        = 62, /* obsolete */
                    CTDB_CONTROL_UPDATE_RECORD           = 63,
                    CTDB_CONTROL_SEND_GRATIOUS_ARP       = 64,
                    CTDB_CONTROL_TRANSACTION_START       = 65,
@@ -355,10 +357,10 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_GET_CAPABILITIES        = 80,
                    CTDB_CONTROL_START_PERSISTENT_UPDATE = 81,
                    CTDB_CONTROL_CANCEL_PERSISTENT_UPDATE= 82,
-                   CTDB_CONTROL_TRANS2_COMMIT           = 83,
-                   CTDB_CONTROL_TRANS2_FINISHED         = 84,
-                   CTDB_CONTROL_TRANS2_ERROR            = 85,
-                   CTDB_CONTROL_TRANS2_COMMIT_RETRY     = 86,
+                   CTDB_CONTROL_TRANS2_COMMIT           = 83, /* obsolete */
+                   CTDB_CONTROL_TRANS2_FINISHED         = 84, /* obsolete */
+                   CTDB_CONTROL_TRANS2_ERROR            = 85, /* obsolete */
+                   CTDB_CONTROL_TRANS2_COMMIT_RETRY     = 86, /* obsolete */
                    CTDB_CONTROL_RECD_PING               = 87,
                    CTDB_CONTROL_RELEASE_IP              = 88,
                    CTDB_CONTROL_TAKEOVER_IP             = 89,
@@ -383,9 +385,9 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_TRANSACTION_CANCEL      = 113,
                    CTDB_CONTROL_REGISTER_NOTIFY         = 114,
                    CTDB_CONTROL_DEREGISTER_NOTIFY       = 115,
-                   CTDB_CONTROL_TRANS2_ACTIVE           = 116,
-                   CTDB_CONTROL_GET_LOG                 = 117,
-                   CTDB_CONTROL_CLEAR_LOG               = 118,
+                   CTDB_CONTROL_TRANS2_ACTIVE           = 116, /* obsolete */
+                   CTDB_CONTROL_GET_LOG                 = 117, /* obsolete */
+                   CTDB_CONTROL_CLEAR_LOG               = 118, /* obsolete */
                    CTDB_CONTROL_TRANS3_COMMIT           = 119,
                    CTDB_CONTROL_GET_DB_SEQNUM           = 120,
                    CTDB_CONTROL_DB_SET_HEALTHY          = 121,
@@ -405,6 +407,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
                    CTDB_CONTROL_TRAVERSE_ALL_EXT        = 135,
                    CTDB_CONTROL_RECEIVE_RECORDS         = 136,
                    CTDB_CONTROL_IPREALLOCATED           = 137,
+                   CTDB_CONTROL_GET_RUNSTATE            = 138,
+                   CTDB_CONTROL_DB_DETACH               = 139,
 };
 
 /*
@@ -509,22 +513,13 @@ struct ctdb_req_keepalive {
 };
 
 
-/* types of failures possible from TRANS2_COMMIT */
-enum ctdb_trans2_commit_error {
-       CTDB_TRANS2_COMMIT_SUCCESS=0, /* all nodes committed successfully */
-       CTDB_TRANS2_COMMIT_TIMEOUT=1, /* at least one node timed out */
-       CTDB_TRANS2_COMMIT_ALLFAIL=2, /* all nodes failed the commit */
-       CTDB_TRANS2_COMMIT_SOMEFAIL=3 /* some nodes failed the commit, some allowed it */
-};
-
 /*
   the extended header for records in the ltdb
 */
 struct ctdb_ltdb_header {
        uint64_t rsn;
        uint32_t dmaster;
-       uint16_t laccessor;
-       uint16_t lacount;
+       uint32_t reserved1;
 #define CTDB_REC_FLAG_DEFAULT                  0x00000000
 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA       0x00010000
 #define CTDB_REC_FLAG_VACUUM_MIGRATED          0x00020000
@@ -584,11 +579,6 @@ struct ctdb_node_map {
 #define NODE_FLAGS_DISABLED            (NODE_FLAGS_UNHEALTHY|NODE_FLAGS_PERMANENTLY_DISABLED)
 #define NODE_FLAGS_INACTIVE            (NODE_FLAGS_DELETED|NODE_FLAGS_DISCONNECTED|NODE_FLAGS_BANNED|NODE_FLAGS_STOPPED)
 
-/* These flags are ONLY valid within the recovery daemon */
-#define NODE_FLAGS_NOIPTAKEOVER                0x01000000 /* can not takeover additional IPs */
-#define NODE_FLAGS_NOIPHOST            0x02000000 /* can not host IPs */
-
-
 /*
  * Node capabilities
  */
@@ -718,10 +708,6 @@ struct ctdb_statistics_wire {
 /*
  * db statistics
  */
-struct ctdb_db_hot_key {
-       uint32_t count;
-       TDB_DATA key;
-};
 struct ctdb_db_statistics {
        struct {
                uint32_t num_calls;
@@ -735,14 +721,11 @@ struct ctdb_db_statistics {
        uint32_t db_ro_revokes;
        uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
        uint32_t num_hot_keys;
-       struct ctdb_db_hot_key hot_keys[MAX_HOT_KEYS];
-};
-struct ctdb_db_statistics_wire {
-       uint32_t db_ro_delegations;
-       uint32_t db_ro_revokes;
-       uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
-       uint32_t num_hot_keys;
-       char hot_keys[1];
+       struct {
+               uint32_t count;
+               TDB_DATA key;
+       } hot_keys[MAX_HOT_KEYS];
+       char hot_keys_wire[1];
 };
 
 /*