]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net> | |
7 | * | |
8 | * This is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | * | |
13 | */ | |
14 | ||
15 | #ifndef CEPH_MDSTABLETYPES_H | |
16 | #define CEPH_MDSTABLETYPES_H | |
17 | ||
18 | // MDS TABLES | |
19 | ||
11fdf7f2 TL |
20 | #include <string_view> |
21 | ||
7c673cae FG |
22 | enum { |
23 | TABLE_ANCHOR, | |
24 | TABLE_SNAP, | |
25 | }; | |
26 | ||
11fdf7f2 | 27 | inline std::string_view get_mdstable_name(int t) { |
7c673cae FG |
28 | switch (t) { |
29 | case TABLE_ANCHOR: return "anchortable"; | |
30 | case TABLE_SNAP: return "snaptable"; | |
11fdf7f2 | 31 | default: ceph_abort(); return std::string_view(); |
7c673cae FG |
32 | } |
33 | } | |
34 | ||
35 | enum { | |
36 | TABLESERVER_OP_QUERY = 1, | |
37 | TABLESERVER_OP_QUERY_REPLY = -2, | |
38 | TABLESERVER_OP_PREPARE = 3, | |
39 | TABLESERVER_OP_AGREE = -4, | |
40 | TABLESERVER_OP_COMMIT = 5, | |
41 | TABLESERVER_OP_ACK = -6, | |
42 | TABLESERVER_OP_ROLLBACK = 7, | |
43 | TABLESERVER_OP_SERVER_UPDATE = 8, | |
44 | TABLESERVER_OP_SERVER_READY = -9, | |
11fdf7f2 TL |
45 | TABLESERVER_OP_NOTIFY_ACK = 10, |
46 | TABLESERVER_OP_NOTIFY_PREP = -11, | |
7c673cae FG |
47 | }; |
48 | ||
11fdf7f2 | 49 | inline std::string_view get_mdstableserver_opname(int op) { |
7c673cae FG |
50 | switch (op) { |
51 | case TABLESERVER_OP_QUERY: return "query"; | |
52 | case TABLESERVER_OP_QUERY_REPLY: return "query_reply"; | |
53 | case TABLESERVER_OP_PREPARE: return "prepare"; | |
54 | case TABLESERVER_OP_AGREE: return "agree"; | |
55 | case TABLESERVER_OP_COMMIT: return "commit"; | |
56 | case TABLESERVER_OP_ACK: return "ack"; | |
57 | case TABLESERVER_OP_ROLLBACK: return "rollback"; | |
58 | case TABLESERVER_OP_SERVER_UPDATE: return "server_update"; | |
59 | case TABLESERVER_OP_SERVER_READY: return "server_ready"; | |
11fdf7f2 TL |
60 | case TABLESERVER_OP_NOTIFY_ACK: return "notify_ack"; |
61 | case TABLESERVER_OP_NOTIFY_PREP: return "notify_prep"; | |
62 | default: ceph_abort(); return std::string_view(); | |
7c673cae FG |
63 | } |
64 | } | |
65 | ||
66 | enum { | |
67 | TABLE_OP_CREATE, | |
68 | TABLE_OP_UPDATE, | |
69 | TABLE_OP_DESTROY, | |
70 | }; | |
71 | ||
11fdf7f2 | 72 | inline std::string_view get_mdstable_opname(int op) { |
7c673cae FG |
73 | switch (op) { |
74 | case TABLE_OP_CREATE: return "create"; | |
75 | case TABLE_OP_UPDATE: return "update"; | |
76 | case TABLE_OP_DESTROY: return "destroy"; | |
11fdf7f2 | 77 | default: ceph_abort(); return std::string_view(); |
7c673cae FG |
78 | } |
79 | } | |
80 | ||
81 | #endif |