|
| 1 | +/* |
| 2 | + * Copyright (C) 2024 Codership Oy <[email protected]> |
| 3 | + * |
| 4 | + * This file is part of wsrep-API. |
| 5 | + * |
| 6 | + * Wsrep-API is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 2 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * Wsrep-API is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with wsrep-API. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +#ifndef WSREP_NODE_ISOLATION_H |
| 21 | +#define WSREP_NODE_ISOLATION_H |
| 22 | + |
| 23 | +/** @file wsrep_node_isolation.h |
| 24 | + * |
| 25 | + * This file defines and interface to isolate the node from |
| 26 | + * the rest of the cluster. The purpose of isolation is to shut |
| 27 | + * down all communication with the rest of the cluster in case |
| 28 | + * of node failure where the node cannot continue reliably anymore, |
| 29 | + * e.g. in case of handling a signal which will terminate the process. |
| 30 | + */ |
| 31 | + |
| 32 | +/** |
| 33 | + * Mode of node isolation. |
| 34 | + */ |
| 35 | +enum wsrep_node_isolation_mode |
| 36 | +{ |
| 37 | + /** Node is not isolated. */ |
| 38 | + WSREP_NODE_ISOLATION_NOT_ISOLATED, |
| 39 | + /** Node is isolated from the rest of the cluster on network |
| 40 | + * level. All ongoing network connections will be terminated and |
| 41 | + * no new connections are accepted. */ |
| 42 | + WSREP_NODE_ISOLATION_ISOLATED, |
| 43 | + /** As WSREP_NODE_ISOLATION_ON, but also force the provider |
| 44 | + * to deliver view with status WSREP_VIEW_DISCONNECTED. */ |
| 45 | + WSREP_NODE_ISOLATION_FORCE_DISCONNECT, |
| 46 | +}; |
| 47 | + |
| 48 | +enum wsrep_node_isolation_result |
| 49 | +{ |
| 50 | + /** Setting the isolation mode was successful. */ |
| 51 | + WSREP_NODE_ISOLATION_SUCCESS, |
| 52 | + /** Invalid isolation mode was passed. */ |
| 53 | + WSREP_NODE_ISOLATION_INVALID_VALUE |
| 54 | +}; |
| 55 | + |
| 56 | +/** Set mode isolation mode according to give wsrep_node_isolation_mode |
| 57 | + * enum. |
| 58 | + * |
| 59 | + * The implementation must be async signal safe to allow calling |
| 60 | + * it from program signal handler. |
| 61 | + * |
| 62 | + * @param mode Mode to set. |
| 63 | + * @return wsrep_node_isolation_result enum. |
| 64 | + */ |
| 65 | +typedef enum wsrep_node_isolation_result (*wsrep_node_isolation_mode_set_fn_v1)( |
| 66 | + enum wsrep_node_isolation_mode mode); |
| 67 | + |
| 68 | +#define WSREP_NODE_ISOLATION_MODE_SET_V1 "wsrep_node_isolation_mode_set_v1" |
| 69 | + |
| 70 | +#endif /* WSREP_NODE_ISOLATION_H */ |
0 commit comments