0.9.8.10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
home
doug
src
hypertable
src
cc
Hyperspace
HsHelpText.cc
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; version 3 of the
9
* License.
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
#include <
Common/Compat.h
>
23
#include "
HsHelpText.h
"
24
25
#include <
Common/StringExt.h
>
26
27
#include <unordered_map>
28
29
using namespace
Hyperspace
;
30
31
namespace
{
32
33
const
char
*help_text_contents[] = {
34
""
,
35
"mkdir ............. Creates a directory in Hyperspace"
,
36
"mkdirs ............ Creates all paths leading upto and including directory in Hyperspace"
,
37
"delete ............ Delete file/directory"
,
38
"open .............. Open a file/directory"
,
39
"create ............ Create a file"
,
40
"close ............. Close previously opened file/directory"
,
41
"attrset ........... Set an attribute (key/value pair) for a file/directory"
,
42
"attrget ........... Retrieve an attribute for a file/directory"
,
43
"attrincr........... Atomically increment the value of an attribute (assumed uint64)"
,
44
"attrexists ........ Check if a particular attribute is set for a file/directory"
,
45
"attrlist .......... Retrieve all attributes (keys only) for a file/directory"
,
46
"attrdel ........... Delete an attribure for a file/directory"
,
47
"exists ............ Check if a file/directory exists"
,
48
"readdir ........... List the contents of a previously opened directory"
,
49
"readdirattr ....... List the contents of a previously opened directory which has"
,
50
" ....... the named attribute set and the value of the attribute"
,
51
"readpathattr ...... List the values of an attribute for each path component of a"
,
52
" ....... previously opened file/directory"
,
53
"lock .............. Lock access to a file/directory"
,
54
"trylock ........... Check whether a lock on file/directory would succeed"
,
55
"release ........... Release previously acquired lock"
,
56
"getseq ............ Get a lock sequencer for a file/directory"
,
57
"echo .............. Echo user input"
,
58
"locate ............ Get the location of Hyperspace Master or all Replicas"
,
59
"dump .............. Dump contents of hyperspace"
60
"status ............ Get server status"
61
""
,
62
"Statements must be terminated with ';' to execute. For more information on"
,
63
"a specific statement, type 'help <statement>', where <statement> is one from"
,
64
"the preceeding list."
,
65
""
,
66
0
67
};
68
69
const
char
*help_mkdir[] = {
70
"mkdir <dir>"
,
71
" This command issues a MKDIR request to Hyperspace."
,
72
(
const
char
*)0
73
};
74
75
const
char
*help_mkdirs[] = {
76
"mkdirs <dir>"
,
77
" This command issues a MKDIRS request to Hyperspace."
,
78
(
const
char
*)0
79
};
80
81
82
const
char
*help_delete[] = {
83
"delete <dir>"
,
84
" This command issues a DELETE request to Hyperspace."
,
85
(
const
char
*)0
86
};
87
88
const
char
*help_open[] = {
89
"open <fname> flags=[READ|WRITE|LOCK|CREATE|EXCL|TEMP|LOCK_SHARED|LOCK_EXCLUSIVE] [event-mask=<mask>]"
,
90
" This command issues an OPEN request to Hyperspace. The optional"
,
91
" parameter event-mask may take a value that is the combination of"
,
92
" the following strings:"
,
93
" ATTR_SET|ATTR_DEL|CHILD_NODE_ADDED|CHILD_NODE_REMOVED|LOCK_ACQUIRED|LOCK_RELEASED"
,
94
(
const
char
*)0
95
};
96
97
const
char
*help_create[] = {
98
"create <fname> flags=[READ|WRITE|LOCK|TEMP|LOCK_SHARED|LOCK_EXCLUSIVE] [OPTIONS]"
,
99
"OPTIONS:"
,
100
" attr:<name>=<value> This can be used to specify extended attributes that should"
,
101
" get created atomically when the file is created"
,
102
" event-mask=<mask> This indicates which events should be delivered on this handle."
,
103
" The <mask> value can take any combination of the following:"
,
104
" ATTR_SET|ATTR_DEL|LOCK_ACQUIRED|LOCK_RELEASED"
,
105
" This command issues an CREATE request to Hyperspace."
,
106
(
const
char
*)0
107
};
108
109
const
char
*help_close[] = {
110
"close <file>"
,
111
" This command issues a CLOSE request to Hyperspace."
,
112
(
const
char
*)0
113
};
114
115
const
char
*help_attrset[] = {
116
"attrset <file> <name>=<value> [i16|i32|i64]"
,
117
" This command issues a ATTRSET request to Hyperspace."
,
118
(
const
char
*)0
119
};
120
121
const
char
*help_attrget[] = {
122
"attrget <file> <name> [int|short|long]"
,
123
" This command issues a ATTRGET request to Hyperspace."
,
124
(
const
char
*)0
125
};
126
127
const
char
*help_attrincr[] = {
128
"attrincr <file> <name> "
,
129
" This command issues a ATTRINCR request to Hyperspace."
,
130
(
const
char
*)0
131
};
132
133
134
const
char
*help_attrexists[] = {
135
"attrexists <file> <name>"
,
136
" This command issues a ATTREXISTS request to Hyperspace."
,
137
(
const
char
*)0
138
};
139
140
const
char
*help_attrlist[] = {
141
"attrlist <file> "
142
" This command issues a ATTRLIST request to Hyperspace."
,
143
(
const
char
*)0
144
};
145
146
const
char
*help_attrdel[] = {
147
"attrdel <file> <name>"
,
148
" This command issues a ATTRDEL request to Hyperspace."
,
149
(
const
char
*)0
150
};
151
152
const
char
*help_exists[] = {
153
"exists <name>"
,
154
" This command issues a EXISTS request to Hyperspace."
,
155
(
const
char
*)0
156
};
157
158
const
char
*help_readdir[] = {
159
"readdir <dir>"
,
160
" This command issues a READDIR request to Hyperspace."
,
161
(
const
char
*)0
162
};
163
164
const
char
*help_readdirattr[] = {
165
"readdirattr [-r] <dir> <name>"
,
166
" This command issues a READDIRATTR request to Hyperspace."
,
167
(
const
char
*)0
168
};
169
170
const
char
*help_readpathattr[] = {
171
"readpathattr <dir> <name>"
,
172
" This command issues a READPATHATTR request to Hyperspace."
,
173
(
const
char
*)0
174
};
175
176
177
const
char
*help_lock[] = {
178
"lock <file> <mode>"
,
179
" This command issues a LOCK request to Hyperspace. The <mode> argument"
,
180
" may be either SHARED or EXCLUSIVE."
,
181
(
const
char
*)0
182
};
183
184
const
char
*help_trylock[] = {
185
"trylock <file> <mode>"
,
186
" This command issues a TRYLOCK request to Hyperspace. The <mode> argument"
,
187
" may be either SHARED or EXCLUSIVE."
,
188
(
const
char
*)0
189
};
190
191
const
char
*help_release[] = {
192
"release <file>"
,
193
" This command issues a RELEASE request to Hyperspace which causes any"
,
194
" lock held by this handle to be released."
,
195
(
const
char
*)0
196
};
197
198
const
char
*help_getsequencer[] = {
199
"getseq <file>"
,
200
" This command gets the lock sequencer for the given file."
,
201
(
const
char
*)0
202
};
203
204
const
char
*help_locate[] = {
205
"locate master|replicas"
,
206
" This command prints out either the location of the Hyperspace replica "
207
" which is the current replication master or the locations of all Hyperspace replicas"
,
208
(
const
char
*)0
209
};
210
211
const
char
*help_dump[] = {
212
"dump <path> [AS_COMMANDS] [output_file]"
,
213
" This command dumps all the contents of Hyperspace under the specified path."
,
214
" If no output_file is specified the contents are dumped to STDOUT."
,
215
" The AS_COMMANDS option prints out the contents as Hyperspace shell commands "
,
216
" for easy reloading back into Hyperspace. To reload while preserving white spaces"
,
217
" in attributes, use something like 'hyperspace --command-file dump_file'."
,
218
(
const
char
*)0
219
};
220
221
222
const
char
*help_status[] = {
223
"status"
,
224
""
,
225
" This command sends a status request to Hyperspace, printing"
,
226
" the status output message to the console and returning the status code."
,
227
" The return value of the last command issued to the interpreter will be"
,
228
" used as the exit status."
,
229
nullptr
230
};
231
232
typedef
std::unordered_map<std::string, const char **> HelpTextMap;
233
234
HelpTextMap &build_help_text_map() {
235
HelpTextMap *map =
new
HelpTextMap();
236
(*map)[
""
] = help_text_contents;
237
(*map)[
"mkdir"
] = help_mkdir;
238
(*map)[
"mkdirs"
] = help_mkdirs;
239
(*map)[
"delete"
] = help_delete;
240
(*map)[
"open"
] = help_open;
241
(*map)[
"create"
] = help_create;
242
(*map)[
"close"
] = help_close;
243
(*map)[
"attrset"
] = help_attrset;
244
(*map)[
"attrget"
] = help_attrget;
245
(*map)[
"attrincr"
] = help_attrincr;
246
(*map)[
"attrexists"
] = help_attrexists;
247
(*map)[
"attrlist"
] = help_attrlist;
248
(*map)[
"attrdel"
] = help_attrdel;
249
(*map)[
"exists"
] = help_exists;
250
(*map)[
"readdir"
] = help_readdir;
251
(*map)[
"readdirattr"
] = help_readdirattr;
252
(*map)[
"readpathattr"
] = help_readpathattr;
253
(*map)[
"lock"
] = help_lock;
254
(*map)[
"trylock"
] = help_trylock;
255
(*map)[
"release"
] = help_release;
256
(*map)[
"getseq"
] = help_getsequencer;
257
(*map)[
"locate"
] = help_locate;
258
(*map)[
"dump"
] = help_dump;
259
(*map)[
"status"
] = help_status;
260
return
*map;
261
}
262
263
HelpTextMap &text_map = build_help_text_map();
264
}
265
266
267
const
char
**
HsHelpText::get
(
const
std::string &subject) {
268
HelpTextMap::const_iterator iter = text_map.find(subject);
269
if
(iter == text_map.end())
270
return
0;
271
return
(*iter).second;
272
}
273
Hyperspace::HsHelpText::get
static const char ** get(const std::string &subject)
Definition:
HsHelpText.cc:267
Hyperspace
Hyperspace definitions
Definition:
BerkeleyDbFilesystem.h:57
HsHelpText.h
Compat.h
Compatibility Macros for C/C++.
StringExt.h
String extensions and helpers: sets, maps, append operators etc.
Generated on Tue Dec 22 2015 18:43:09 for Hypertable by
1.8.8