0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
StateDbKeys.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable 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 this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
22 #ifndef HT_HYPERSPACESTATEDBKEYS_H
23 #define HT_HYPERSPACESTATEDBKEYS_H
24 
25 #include "Common/Compat.h"
26 #include <vector>
27 
28 #include "Common/String.h"
29 #include "Common/Serialization.h"
30 
31 namespace Hyperspace {
32 
33 using namespace Hypertable;
34 using namespace Serialization;
35 
36 namespace StateDbKeys {
37  enum {
38  //Delimeters
39  PATH_DELIM = 0x00000001,
40 
41  //SessionMap
42  SESSIONS = 0x40000001,
43  //SessionData
50 
51  //HandleMap
52  HANDLES = 0x60000001,
53  //Handle state
62 
63  //NodeMap
64  NODES = 0x80000001,
65  //Node state
75 
76  //Events
77  EVENTS = 0xa0000001,
85 
86  };
87 
88  const String PATH_DELIM_STR = "/";
89 
90  const String HANDLES_STR = PATH_DELIM_STR + "HANDLES"
92  const String HANDLE_OPEN_FLAGS_STR = "FLAG";
94  const String HANDLE_EVENT_MASK_STR = "EVT_MASK";
95  const String HANDLE_LOCKED_STR = "LCKD";
96  const String HANDLE_NODE_NAME_STR = "NODE_NAME";
97  const String HANDLE_SESSION_ID_STR = "SESSN_ID";
98 
99 
100  const String SESSIONS_STR = PATH_DELIM_STR +
101  "SESSIONS" +
103  const String SESSION_ADDR_STR = "ADDR";
105  const String SESSION_HANDLES_STR = "HANDLES" +
107  const String SESSION_NAME_STR = "NAME";
108 
109  const String NODES_STR = PATH_DELIM_STR +
110  "NODES" +
112  const String NODE_EPHEMERAL_STR = "EPHMRL";
113  const String NODE_LOCK_MODE_STR = "LK_MD";
117  const String NODE_PENDING_LOCK_REQUESTS_STR = "PNDG_LK_REQS";
118  const String NODE_HANDLE_MAP_STR = "HDL_MAP";
119  const String NODE_HANDLE_MAP_SIZE_STR = "HDL_MAP_SZ";
120 
121 
122  const String EVENTS_STR = PATH_DELIM_STR + "EVENTS" + PATH_DELIM_STR;
123  const String EVENT_TYPE_STR = "TYPE";
124  const String EVENT_MASK_STR = "MASK";
125  const String EVENT_NAME_STR = "NAME";
126  const String EVENT_MODE_STR = "MODE";
129 
130  const String NEXT_IDS = "/NXT_ID/";
131  const String NEXT_SESSION_ID = NEXT_IDS + "SESS";
132  const String NEXT_EVENT_ID = NEXT_IDS + "EVT";
133  const String NEXT_HANDLE_ID = NEXT_IDS + "HDL";
134 
135  /*
136  * Get State key for specified piece of state for specified session
137  *
138  * @param id Session id
139  * @param key_type requested piece of state
140  * @return String key for storage/retrieval in BerkeleyDB
141  */
142  String get_session_key(uint64_t id, uint32_t key_type);
143 
144  /*
145  * Get State key to a piece of Event object
146  *
147  * @param id Event id
148  * @param key_type requested piece of state
149  * @return String key for storage/retrieval in BerkeleyDB
150  */
151  String get_event_key(uint64_t id, uint32_t key_type);
152 
153  /*
154  * Get State key to a piece of handle data
155  *
156  * @param id handle id
157  * @param key_type requested piece of state
158  * @return String key for storage/retrieval in BerkeleyDB
159  */
160  String get_handle_key(uint64_t id, uint32_t key_type);
161 
162  /*
163  * Get State key to a piece of a node state
164  *
165  * @param name Node name
166  * @param key_type requested piece of state
167  * @return String key for storage/retrieval in BerkeleyDB
168  */
169  String get_node_key(const String &name, uint32_t key_type);
170 
171  /*
172  * Get State key to access/store a specific node lock request
173  *
174  * @param name Node name
175  * @param handle_id
176  * @return String key for storage/retrieval in BerkeleyDB
177  */
178  String get_node_pending_lock_request_key(const String &name, uint64_t handle_id);
179 
180 
181 } //namespace StateDbKeys
182 } // namespace Hyperspace
183 
184 #endif //HT_HYPERSPACESTATEDBKEYS_H
const String HANDLE_DEL_STATE_STR
Definition: StateDbKeys.h:93
const String EVENT_GENERATION_STR
Definition: StateDbKeys.h:127
const String SESSION_HANDLES_STR
Definition: StateDbKeys.h:105
const String NEXT_SESSION_ID
Definition: StateDbKeys.h:131
const String NODE_SHARED_LOCK_HANDLES_STR
Definition: StateDbKeys.h:116
const String HANDLE_EVENT_MASK_STR
Definition: StateDbKeys.h:94
const String NEXT_EVENT_ID
Definition: StateDbKeys.h:132
const String SESSION_ADDR_STR
Definition: StateDbKeys.h:103
String get_event_key(uint64_t id, uint32_t type)
Definition: StateDbKeys.cc:36
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
const String PATH_DELIM_STR
Definition: StateDbKeys.h:88
String get_session_key(uint64_t id, uint32_t type)
Definition: StateDbKeys.cc:64
const String EVENTS_STR
Definition: StateDbKeys.h:122
const String EVENT_NAME_STR
Definition: StateDbKeys.h:125
const String SESSIONS_STR
Definition: StateDbKeys.h:100
const String NODE_PENDING_LOCK_REQUESTS_STR
Definition: StateDbKeys.h:117
const String SESSION_NAME_STR
Definition: StateDbKeys.h:107
const String NODES_STR
Definition: StateDbKeys.h:109
Hyperspace definitions
const String EVENT_NOTIFICATION_HANDLES_STR
Definition: StateDbKeys.h:128
const String HANDLE_SESSION_ID_STR
Definition: StateDbKeys.h:97
const String NODE_HANDLE_MAP_SIZE_STR
Definition: StateDbKeys.h:119
const String NODE_EPHEMERAL_STR
Definition: StateDbKeys.h:112
Compatibility Macros for C/C++.
Functions to serialize/deserialize primitives to/from a memory buffer.
const String HANDLE_NODE_NAME_STR
Definition: StateDbKeys.h:96
const String NODE_EXCLUSIVE_LOCK_HANDLE_STR
Definition: StateDbKeys.h:115
const String EVENT_TYPE_STR
Definition: StateDbKeys.h:123
const String EVENT_MODE_STR
Definition: StateDbKeys.h:126
Hypertable definitions
const String NEXT_HANDLE_ID
Definition: StateDbKeys.h:133
const String HANDLE_OPEN_FLAGS_STR
Definition: StateDbKeys.h:92
const String HANDLES_STR
Definition: StateDbKeys.h:90
A String class based on std::string.
const String HANDLE_LOCKED_STR
Definition: StateDbKeys.h:95
const String NODE_LOCK_GENERATION_STR
Definition: StateDbKeys.h:114
String get_handle_key(uint64_t id, uint32_t type)
Definition: StateDbKeys.cc:86
const String NODE_LOCK_MODE_STR
Definition: StateDbKeys.h:113
const String SESSION_EXPIRED_STR
Definition: StateDbKeys.h:104
const String EVENT_MASK_STR
Definition: StateDbKeys.h:124
String get_node_pending_lock_request_key(const String &name, uint64_t handle_id)
Definition: StateDbKeys.cc:152
String get_node_key(const String &name, uint32_t type)
Definition: StateDbKeys.cc:114
const String NODE_HANDLE_MAP_STR
Definition: StateDbKeys.h:118