]> git.proxmox.com Git - pve-cluster.git/blob - data/src/dcdb.h
0da2afe896e752789b5494f8a6d0e99429e1026c
[pve-cluster.git] / data / src / dcdb.h
1 /*
2 Copyright (C) 2010 Proxmox Server Solutions GmbH
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Affero General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Affero General Public License for more details.
13
14 You should have received a copy of the GNU Affero General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 Author: Dietmar Maurer <dietmar@proxmox.com>
18
19 */
20
21 #ifndef _PVE_DCDB_H_
22 #define _PVE_DCDB_H_
23
24 #include <glib.h>
25
26 #include "dfsm.h"
27 #include "memdb.h"
28
29 #define DCDB_CPG_GROUP_NAME "pve_dcdb_v1"
30 /* please increase protocol version if you want to stop older nodes */
31 #define DCDB_PROTOCOL_VERSION 1
32 #define DCDB_VERIFY_TIME (60*60)
33
34 typedef enum {
35 DCDB_MESSAGE_CFS_WRITE = 1,
36 DCDB_MESSAGE_CFS_MKDIR = 2,
37 DCDB_MESSAGE_CFS_DELETE = 3,
38 DCDB_MESSAGE_CFS_RENAME = 4,
39 DCDB_MESSAGE_CFS_CREATE = 5,
40 DCDB_MESSAGE_CFS_MTIME = 6,
41 DCDB_MESSAGE_CFS_UNLOCK_REQUEST = 7,
42 DCDB_MESSAGE_CFS_UNLOCK = 8,
43 } dcdb_message_t;
44
45 #define DCDB_VALID_MESSAGE_TYPE(mt) (mt >= DCDB_MESSAGE_CFS_WRITE && mt <= DCDB_MESSAGE_CFS_UNLOCK)
46
47 dfsm_t *dcdb_new(memdb_t *memdb);
48
49 void dcdb_sync_corosync_conf(
50 memdb_t *memdb,
51 gboolean notify_corosync);
52
53 int dcdb_send_fuse_message(
54 dfsm_t *dfsm,
55 dcdb_message_t msg_type,
56 const char *path,
57 const char *to,
58 const char *buf,
59 guint32 size,
60 guint32 offset,
61 guint32 flags);
62
63 void
64 dcdb_send_unlock(
65 dfsm_t *dfsm,
66 const char *path,
67 const guchar csum[32],
68 gboolean request);
69
70 #endif /* _PVE_DCDB_H_ */