summaryrefslogtreecommitdiff
path: root/src/mds/mds_table_types.h
blob: b094c752565e5a6fbdfde9a725773a19a57f889e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
// vim: ts=8 sw=2 smarttab
/*
 * Ceph - scalable distributed file system
 *
 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software 
 * Foundation.  See file COPYING.
 * 
 */

#ifndef CEPH_MDSTABLETYPES_H
#define CEPH_MDSTABLETYPES_H

// MDS TABLES

enum {
  TABLE_ANCHOR,
  TABLE_SNAP,
};

inline const char *get_mdstable_name(int t) {
  switch (t) {
  case TABLE_ANCHOR: return "anchortable";
  case TABLE_SNAP: return "snaptable";
  default: assert(0);
  }
}

enum {
  TABLESERVER_OP_QUERY        =  1,
  TABLESERVER_OP_QUERY_REPLY  = -2,
  TABLESERVER_OP_PREPARE      =  3,
  TABLESERVER_OP_AGREE        = -4,
  TABLESERVER_OP_COMMIT       =  5,
  TABLESERVER_OP_ACK          = -6,
  TABLESERVER_OP_ROLLBACK     =  7,
  TABLESERVER_OP_SERVER_UPDATE = 8,
};

inline const char *get_mdstableserver_opname(int op) {
  switch (op) {
  case TABLESERVER_OP_QUERY: return "query";
  case TABLESERVER_OP_QUERY_REPLY: return "query_reply";
  case TABLESERVER_OP_PREPARE: return "prepare";
  case TABLESERVER_OP_AGREE: return "agree";
  case TABLESERVER_OP_COMMIT: return "commit";
  case TABLESERVER_OP_ACK: return "ack";
  case TABLESERVER_OP_ROLLBACK: return "rollback";
  case TABLESERVER_OP_SERVER_UPDATE: return "server_update";
  default: assert(0); return 0;
  }
};

enum {
  TABLE_OP_CREATE,
  TABLE_OP_UPDATE,
  TABLE_OP_DESTROY,
};

inline const char *get_mdstable_opname(int op) {
  switch (op) {
  case TABLE_OP_CREATE: return "create";
  case TABLE_OP_UPDATE: return "update";
  case TABLE_OP_DESTROY: return "destroy";
  default: assert(0); return 0;
  }
};

#endif