ruby-hdfs-cdh4 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,645 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #ifndef LIBHDFS_HDFS_H
20
+ #define LIBHDFS_HDFS_H
21
+
22
+ #include <errno.h> /* for EINTERNAL, etc. */
23
+ #include <fcntl.h> /* for O_RDONLY, O_WRONLY */
24
+ #include <stdint.h> /* for uint64_t, etc. */
25
+ #include <time.h> /* for time_t */
26
+
27
+ #ifndef O_RDONLY
28
+ #define O_RDONLY 1
29
+ #endif
30
+
31
+ #ifndef O_WRONLY
32
+ #define O_WRONLY 2
33
+ #endif
34
+
35
+ #ifndef EINTERNAL
36
+ #define EINTERNAL 255
37
+ #endif
38
+
39
+
40
+ /** All APIs set errno to meaningful values */
41
+
42
+ #ifdef __cplusplus
43
+ extern "C" {
44
+ #endif
45
+ /**
46
+ * Some utility decls used in libhdfs.
47
+ */
48
+ struct hdfsBuilder;
49
+ typedef int32_t tSize; /// size of data for read/write io ops
50
+ typedef time_t tTime; /// time type in seconds
51
+ typedef int64_t tOffset;/// offset within the file
52
+ typedef uint16_t tPort; /// port
53
+ typedef enum tObjectKind {
54
+ kObjectKindFile = 'F',
55
+ kObjectKindDirectory = 'D',
56
+ } tObjectKind;
57
+
58
+
59
+ /**
60
+ * The C reflection of org.apache.org.hadoop.FileSystem .
61
+ */
62
+ struct hdfs_internal;
63
+ typedef struct hdfs_internal* hdfsFS;
64
+
65
+ struct hdfsFile_internal;
66
+ typedef struct hdfsFile_internal* hdfsFile;
67
+
68
+ /**
69
+ * Determine if a file is open for read.
70
+ *
71
+ * @param file The HDFS file
72
+ * @return 1 if the file is open for read; 0 otherwise
73
+ */
74
+ int hdfsFileIsOpenForRead(hdfsFile file);
75
+
76
+ /**
77
+ * Determine if a file is open for write.
78
+ *
79
+ * @param file The HDFS file
80
+ * @return 1 if the file is open for write; 0 otherwise
81
+ */
82
+ int hdfsFileIsOpenForWrite(hdfsFile file);
83
+
84
+ /**
85
+ * hdfsConnectAsUser - Connect to a hdfs file system as a specific user
86
+ * Connect to the hdfs.
87
+ * @param nn The NameNode. See hdfsBuilderSetNameNode for details.
88
+ * @param port The port on which the server is listening.
89
+ * @param user the user name (this is hadoop domain user). Or NULL is equivelant to hhdfsConnect(host, port)
90
+ * @return Returns a handle to the filesystem or NULL on error.
91
+ * @deprecated Use hdfsBuilderConnect instead.
92
+ */
93
+ hdfsFS hdfsConnectAsUser(const char* nn, tPort port, const char *user);
94
+
95
+ /**
96
+ * hdfsConnect - Connect to a hdfs file system.
97
+ * Connect to the hdfs.
98
+ * @param nn The NameNode. See hdfsBuilderSetNameNode for details.
99
+ * @param port The port on which the server is listening.
100
+ * @return Returns a handle to the filesystem or NULL on error.
101
+ * @deprecated Use hdfsBuilderConnect instead.
102
+ */
103
+ hdfsFS hdfsConnect(const char* nn, tPort port);
104
+
105
+ /**
106
+ * hdfsConnect - Connect to an hdfs file system.
107
+ *
108
+ * Forces a new instance to be created
109
+ *
110
+ * @param nn The NameNode. See hdfsBuilderSetNameNode for details.
111
+ * @param port The port on which the server is listening.
112
+ * @param user The user name to use when connecting
113
+ * @return Returns a handle to the filesystem or NULL on error.
114
+ * @deprecated Use hdfsBuilderConnect instead.
115
+ */
116
+ hdfsFS hdfsConnectAsUserNewInstance(const char* nn, tPort port, const char *user );
117
+
118
+ /**
119
+ * hdfsConnect - Connect to an hdfs file system.
120
+ *
121
+ * Forces a new instance to be created
122
+ *
123
+ * @param nn The NameNode. See hdfsBuilderSetNameNode for details.
124
+ * @param port The port on which the server is listening.
125
+ * @return Returns a handle to the filesystem or NULL on error.
126
+ * @deprecated Use hdfsBuilderConnect instead.
127
+ */
128
+ hdfsFS hdfsConnectNewInstance(const char* nn, tPort port);
129
+
130
+ /**
131
+ * Connect to HDFS using the parameters defined by the builder.
132
+ *
133
+ * The HDFS builder will be freed, whether or not the connection was
134
+ * successful.
135
+ *
136
+ * Every successful call to hdfsBuilderConnect should be matched with a call
137
+ * to hdfsDisconnect, when the hdfsFS is no longer needed.
138
+ *
139
+ * @param bld The HDFS builder
140
+ * @return Returns a handle to the filesystem, or NULL on error.
141
+ */
142
+ hdfsFS hdfsBuilderConnect(struct hdfsBuilder *bld);
143
+
144
+ /**
145
+ * Create an HDFS builder.
146
+ *
147
+ * @return The HDFS builder, or NULL on error.
148
+ */
149
+ struct hdfsBuilder *hdfsNewBuilder(void);
150
+
151
+ /**
152
+ * Force the builder to always create a new instance of the FileSystem,
153
+ * rather than possibly finding one in the cache.
154
+ *
155
+ * @param bld The HDFS builder
156
+ */
157
+ void hdfsBuilderSetForceNewInstance(struct hdfsBuilder *bld);
158
+
159
+ /**
160
+ * Set the HDFS NameNode to connect to.
161
+ *
162
+ * @param bld The HDFS builder
163
+ * @param nn The NameNode to use.
164
+ *
165
+ * If the string given is 'default', the default NameNode
166
+ * configuration will be used (from the XML configuration files)
167
+ *
168
+ * If NULL is given, a LocalFileSystem will be created.
169
+ *
170
+ * If the string starts with a protocol type such as file:// or
171
+ * hdfs://, this protocol type will be used. If not, the
172
+ * hdfs:// protocol type will be used.
173
+ *
174
+ * You may specify a NameNode port in the usual way by
175
+ * passing a string of the format hdfs://<hostname>:<port>.
176
+ * Alternately, you may set the port with
177
+ * hdfsBuilderSetNameNodePort. However, you must not pass the
178
+ * port in two different ways.
179
+ */
180
+ void hdfsBuilderSetNameNode(struct hdfsBuilder *bld, const char *nn);
181
+
182
+ /**
183
+ * Set the port of the HDFS NameNode to connect to.
184
+ *
185
+ * @param bld The HDFS builder
186
+ * @param port The port.
187
+ */
188
+ void hdfsBuilderSetNameNodePort(struct hdfsBuilder *bld, tPort port);
189
+
190
+ /**
191
+ * Set the username to use when connecting to the HDFS cluster.
192
+ *
193
+ * @param bld The HDFS builder
194
+ * @param userName The user name. The string will be shallow-copied.
195
+ */
196
+ void hdfsBuilderSetUserName(struct hdfsBuilder *bld, const char *userName);
197
+
198
+ /**
199
+ * Set the path to the Kerberos ticket cache to use when connecting to
200
+ * the HDFS cluster.
201
+ *
202
+ * @param bld The HDFS builder
203
+ * @param kerbTicketCachePath The Kerberos ticket cache path. The string
204
+ * will be shallow-copied.
205
+ */
206
+ void hdfsBuilderSetKerbTicketCachePath(struct hdfsBuilder *bld,
207
+ const char *kerbTicketCachePath);
208
+
209
+ /**
210
+ * Free an HDFS builder.
211
+ *
212
+ * It is normally not necessary to call this function since
213
+ * hdfsBuilderConnect frees the builder.
214
+ *
215
+ * @param bld The HDFS builder
216
+ */
217
+ void hdfsFreeBuilder(struct hdfsBuilder *bld);
218
+
219
+ /**
220
+ * Set a configuration string for an HdfsBuilder.
221
+ *
222
+ * @param key The key to set.
223
+ * @param val The value, or NULL to set no value.
224
+ * This will be shallow-copied. You are responsible for
225
+ * ensuring that it remains valid until the builder is
226
+ * freed.
227
+ *
228
+ * @return 0 on success; nonzero error code otherwise.
229
+ */
230
+ int hdfsBuilderConfSetStr(struct hdfsBuilder *bld, const char *key,
231
+ const char *val);
232
+
233
+ /**
234
+ * Get a configuration string.
235
+ *
236
+ * @param key The key to find
237
+ * @param val (out param) The value. This will be set to NULL if the
238
+ * key isn't found. You must free this string with
239
+ * hdfsConfStrFree.
240
+ *
241
+ * @return 0 on success; nonzero error code otherwise.
242
+ * Failure to find the key is not an error.
243
+ */
244
+ int hdfsConfGetStr(const char *key, char **val);
245
+
246
+ /**
247
+ * Get a configuration integer.
248
+ *
249
+ * @param key The key to find
250
+ * @param val (out param) The value. This will NOT be changed if the
251
+ * key isn't found.
252
+ *
253
+ * @return 0 on success; nonzero error code otherwise.
254
+ * Failure to find the key is not an error.
255
+ */
256
+ int hdfsConfGetInt(const char *key, int32_t *val);
257
+
258
+ /**
259
+ * Free a configuration string found with hdfsConfGetStr.
260
+ *
261
+ * @param val A configuration string obtained from hdfsConfGetStr
262
+ */
263
+ void hdfsConfStrFree(char *val);
264
+
265
+ /**
266
+ * hdfsDisconnect - Disconnect from the hdfs file system.
267
+ * Disconnect from hdfs.
268
+ * @param fs The configured filesystem handle.
269
+ * @return Returns 0 on success, -1 on error.
270
+ * Even if there is an error, the resources associated with the
271
+ * hdfsFS will be freed.
272
+ */
273
+ int hdfsDisconnect(hdfsFS fs);
274
+
275
+
276
+ /**
277
+ * hdfsOpenFile - Open a hdfs file in given mode.
278
+ * @param fs The configured filesystem handle.
279
+ * @param path The full path to the file.
280
+ * @param flags - an | of bits/fcntl.h file flags - supported flags are O_RDONLY, O_WRONLY (meaning create or overwrite i.e., implies O_TRUNCAT),
281
+ * O_WRONLY|O_APPEND. Other flags are generally ignored other than (O_RDWR || (O_EXCL & O_CREAT)) which return NULL and set errno equal ENOTSUP.
282
+ * @param bufferSize Size of buffer for read/write - pass 0 if you want
283
+ * to use the default configured values.
284
+ * @param replication Block replication - pass 0 if you want to use
285
+ * the default configured values.
286
+ * @param blocksize Size of block - pass 0 if you want to use the
287
+ * default configured values.
288
+ * @return Returns the handle to the open file or NULL on error.
289
+ */
290
+ hdfsFile hdfsOpenFile(hdfsFS fs, const char* path, int flags,
291
+ int bufferSize, short replication, tSize blocksize);
292
+
293
+
294
+ /**
295
+ * hdfsCloseFile - Close an open file.
296
+ * @param fs The configured filesystem handle.
297
+ * @param file The file handle.
298
+ * @return Returns 0 on success, -1 on error.
299
+ * On error, errno will be set appropriately.
300
+ * If the hdfs file was valid, the memory associated with it will
301
+ * be freed at the end of this call, even if there was an I/O
302
+ * error.
303
+ */
304
+ int hdfsCloseFile(hdfsFS fs, hdfsFile file);
305
+
306
+
307
+ /**
308
+ * hdfsExists - Checks if a given path exsits on the filesystem
309
+ * @param fs The configured filesystem handle.
310
+ * @param path The path to look for
311
+ * @return Returns 0 on success, -1 on error.
312
+ */
313
+ int hdfsExists(hdfsFS fs, const char *path);
314
+
315
+
316
+ /**
317
+ * hdfsSeek - Seek to given offset in file.
318
+ * This works only for files opened in read-only mode.
319
+ * @param fs The configured filesystem handle.
320
+ * @param file The file handle.
321
+ * @param desiredPos Offset into the file to seek into.
322
+ * @return Returns 0 on success, -1 on error.
323
+ */
324
+ int hdfsSeek(hdfsFS fs, hdfsFile file, tOffset desiredPos);
325
+
326
+
327
+ /**
328
+ * hdfsTell - Get the current offset in the file, in bytes.
329
+ * @param fs The configured filesystem handle.
330
+ * @param file The file handle.
331
+ * @return Current offset, -1 on error.
332
+ */
333
+ tOffset hdfsTell(hdfsFS fs, hdfsFile file);
334
+
335
+
336
+ /**
337
+ * hdfsRead - Read data from an open file.
338
+ * @param fs The configured filesystem handle.
339
+ * @param file The file handle.
340
+ * @param buffer The buffer to copy read bytes into.
341
+ * @param length The length of the buffer.
342
+ * @return On success, a positive number indicating how many bytes
343
+ * were read.
344
+ * On end-of-file, 0.
345
+ * On error, -1. Errno will be set to the error code.
346
+ * Just like the POSIX read function, hdfsRead will return -1
347
+ * and set errno to EINTR if data is temporarily unavailable,
348
+ * but we are not yet at the end of the file.
349
+ */
350
+ tSize hdfsRead(hdfsFS fs, hdfsFile file, void* buffer, tSize length);
351
+
352
+ /**
353
+ * hdfsPread - Positional read of data from an open file.
354
+ * @param fs The configured filesystem handle.
355
+ * @param file The file handle.
356
+ * @param position Position from which to read
357
+ * @param buffer The buffer to copy read bytes into.
358
+ * @param length The length of the buffer.
359
+ * @return See hdfsRead
360
+ */
361
+ tSize hdfsPread(hdfsFS fs, hdfsFile file, tOffset position,
362
+ void* buffer, tSize length);
363
+
364
+
365
+ /**
366
+ * hdfsWrite - Write data into an open file.
367
+ * @param fs The configured filesystem handle.
368
+ * @param file The file handle.
369
+ * @param buffer The data.
370
+ * @param length The no. of bytes to write.
371
+ * @return Returns the number of bytes written, -1 on error.
372
+ */
373
+ tSize hdfsWrite(hdfsFS fs, hdfsFile file, const void* buffer,
374
+ tSize length);
375
+
376
+
377
+ /**
378
+ * hdfsWrite - Flush the data.
379
+ * @param fs The configured filesystem handle.
380
+ * @param file The file handle.
381
+ * @return Returns 0 on success, -1 on error.
382
+ */
383
+ int hdfsFlush(hdfsFS fs, hdfsFile file);
384
+
385
+
386
+ /**
387
+ * hdfsHFlush - Flush out the data in client's user buffer. After the
388
+ * return of this call, new readers will see the data.
389
+ * @param fs configured filesystem handle
390
+ * @param file file handle
391
+ * @return 0 on success, -1 on error and sets errno
392
+ */
393
+ int hdfsHFlush(hdfsFS fs, hdfsFile file);
394
+
395
+
396
+ /**
397
+ * hdfsAvailable - Number of bytes that can be read from this
398
+ * input stream without blocking.
399
+ * @param fs The configured filesystem handle.
400
+ * @param file The file handle.
401
+ * @return Returns available bytes; -1 on error.
402
+ */
403
+ int hdfsAvailable(hdfsFS fs, hdfsFile file);
404
+
405
+
406
+ /**
407
+ * hdfsCopy - Copy file from one filesystem to another.
408
+ * @param srcFS The handle to source filesystem.
409
+ * @param src The path of source file.
410
+ * @param dstFS The handle to destination filesystem.
411
+ * @param dst The path of destination file.
412
+ * @return Returns 0 on success, -1 on error.
413
+ */
414
+ int hdfsCopy(hdfsFS srcFS, const char* src, hdfsFS dstFS, const char* dst);
415
+
416
+
417
+ /**
418
+ * hdfsMove - Move file from one filesystem to another.
419
+ * @param srcFS The handle to source filesystem.
420
+ * @param src The path of source file.
421
+ * @param dstFS The handle to destination filesystem.
422
+ * @param dst The path of destination file.
423
+ * @return Returns 0 on success, -1 on error.
424
+ */
425
+ int hdfsMove(hdfsFS srcFS, const char* src, hdfsFS dstFS, const char* dst);
426
+
427
+
428
+ /**
429
+ * hdfsDelete - Delete file.
430
+ * @param fs The configured filesystem handle.
431
+ * @param path The path of the file.
432
+ * @param recursive if path is a directory and set to
433
+ * non-zero, the directory is deleted else throws an exception. In
434
+ * case of a file the recursive argument is irrelevant.
435
+ * @return Returns 0 on success, -1 on error.
436
+ */
437
+ int hdfsDelete(hdfsFS fs, const char* path, int recursive);
438
+
439
+ /**
440
+ * hdfsRename - Rename file.
441
+ * @param fs The configured filesystem handle.
442
+ * @param oldPath The path of the source file.
443
+ * @param newPath The path of the destination file.
444
+ * @return Returns 0 on success, -1 on error.
445
+ */
446
+ int hdfsRename(hdfsFS fs, const char* oldPath, const char* newPath);
447
+
448
+
449
+ /**
450
+ * hdfsGetWorkingDirectory - Get the current working directory for
451
+ * the given filesystem.
452
+ * @param fs The configured filesystem handle.
453
+ * @param buffer The user-buffer to copy path of cwd into.
454
+ * @param bufferSize The length of user-buffer.
455
+ * @return Returns buffer, NULL on error.
456
+ */
457
+ char* hdfsGetWorkingDirectory(hdfsFS fs, char *buffer, size_t bufferSize);
458
+
459
+
460
+ /**
461
+ * hdfsSetWorkingDirectory - Set the working directory. All relative
462
+ * paths will be resolved relative to it.
463
+ * @param fs The configured filesystem handle.
464
+ * @param path The path of the new 'cwd'.
465
+ * @return Returns 0 on success, -1 on error.
466
+ */
467
+ int hdfsSetWorkingDirectory(hdfsFS fs, const char* path);
468
+
469
+
470
+ /**
471
+ * hdfsCreateDirectory - Make the given file and all non-existent
472
+ * parents into directories.
473
+ * @param fs The configured filesystem handle.
474
+ * @param path The path of the directory.
475
+ * @return Returns 0 on success, -1 on error.
476
+ */
477
+ int hdfsCreateDirectory(hdfsFS fs, const char* path);
478
+
479
+
480
+ /**
481
+ * hdfsSetReplication - Set the replication of the specified
482
+ * file to the supplied value
483
+ * @param fs The configured filesystem handle.
484
+ * @param path The path of the file.
485
+ * @return Returns 0 on success, -1 on error.
486
+ */
487
+ int hdfsSetReplication(hdfsFS fs, const char* path, int16_t replication);
488
+
489
+
490
+ /**
491
+ * hdfsFileInfo - Information about a file/directory.
492
+ */
493
+ typedef struct {
494
+ tObjectKind mKind; /* file or directory */
495
+ char *mName; /* the name of the file */
496
+ tTime mLastMod; /* the last modification time for the file in seconds */
497
+ tOffset mSize; /* the size of the file in bytes */
498
+ short mReplication; /* the count of replicas */
499
+ tOffset mBlockSize; /* the block size for the file */
500
+ char *mOwner; /* the owner of the file */
501
+ char *mGroup; /* the group associated with the file */
502
+ short mPermissions; /* the permissions associated with the file */
503
+ tTime mLastAccess; /* the last access time for the file in seconds */
504
+ } hdfsFileInfo;
505
+
506
+
507
+ /**
508
+ * hdfsListDirectory - Get list of files/directories for a given
509
+ * directory-path. hdfsFreeFileInfo should be called to deallocate memory.
510
+ * @param fs The configured filesystem handle.
511
+ * @param path The path of the directory.
512
+ * @param numEntries Set to the number of files/directories in path.
513
+ * @return Returns a dynamically-allocated array of hdfsFileInfo
514
+ * objects; NULL on error.
515
+ */
516
+ hdfsFileInfo *hdfsListDirectory(hdfsFS fs, const char* path,
517
+ int *numEntries);
518
+
519
+
520
+ /**
521
+ * hdfsGetPathInfo - Get information about a path as a (dynamically
522
+ * allocated) single hdfsFileInfo struct. hdfsFreeFileInfo should be
523
+ * called when the pointer is no longer needed.
524
+ * @param fs The configured filesystem handle.
525
+ * @param path The path of the file.
526
+ * @return Returns a dynamically-allocated hdfsFileInfo object;
527
+ * NULL on error.
528
+ */
529
+ hdfsFileInfo *hdfsGetPathInfo(hdfsFS fs, const char* path);
530
+
531
+
532
+ /**
533
+ * hdfsFreeFileInfo - Free up the hdfsFileInfo array (including fields)
534
+ * @param hdfsFileInfo The array of dynamically-allocated hdfsFileInfo
535
+ * objects.
536
+ * @param numEntries The size of the array.
537
+ */
538
+ void hdfsFreeFileInfo(hdfsFileInfo *hdfsFileInfo, int numEntries);
539
+
540
+
541
+ /**
542
+ * hdfsGetHosts - Get hostnames where a particular block (determined by
543
+ * pos & blocksize) of a file is stored. The last element in the array
544
+ * is NULL. Due to replication, a single block could be present on
545
+ * multiple hosts.
546
+ * @param fs The configured filesystem handle.
547
+ * @param path The path of the file.
548
+ * @param start The start of the block.
549
+ * @param length The length of the block.
550
+ * @return Returns a dynamically-allocated 2-d array of blocks-hosts;
551
+ * NULL on error.
552
+ */
553
+ char*** hdfsGetHosts(hdfsFS fs, const char* path,
554
+ tOffset start, tOffset length);
555
+
556
+
557
+ /**
558
+ * hdfsFreeHosts - Free up the structure returned by hdfsGetHosts
559
+ * @param hdfsFileInfo The array of dynamically-allocated hdfsFileInfo
560
+ * objects.
561
+ * @param numEntries The size of the array.
562
+ */
563
+ void hdfsFreeHosts(char ***blockHosts);
564
+
565
+
566
+ /**
567
+ * hdfsGetDefaultBlockSize - Get the default blocksize.
568
+ *
569
+ * @param fs The configured filesystem handle.
570
+ * @deprecated Use hdfsGetDefaultBlockSizeAtPath instead.
571
+ *
572
+ * @return Returns the default blocksize, or -1 on error.
573
+ */
574
+ tOffset hdfsGetDefaultBlockSize(hdfsFS fs);
575
+
576
+
577
+ /**
578
+ * hdfsGetDefaultBlockSizeAtPath - Get the default blocksize at the
579
+ * filesystem indicated by a given path.
580
+ *
581
+ * @param fs The configured filesystem handle.
582
+ * @param path The given path will be used to locate the actual
583
+ * filesystem. The full path does not have to exist.
584
+ *
585
+ * @return Returns the default blocksize, or -1 on error.
586
+ */
587
+ tOffset hdfsGetDefaultBlockSizeAtPath(hdfsFS fs, const char *path);
588
+
589
+
590
+ /**
591
+ * hdfsGetCapacity - Return the raw capacity of the filesystem.
592
+ * @param fs The configured filesystem handle.
593
+ * @return Returns the raw-capacity; -1 on error.
594
+ */
595
+ tOffset hdfsGetCapacity(hdfsFS fs);
596
+
597
+
598
+ /**
599
+ * hdfsGetUsed - Return the total raw size of all files in the filesystem.
600
+ * @param fs The configured filesystem handle.
601
+ * @return Returns the total-size; -1 on error.
602
+ */
603
+ tOffset hdfsGetUsed(hdfsFS fs);
604
+
605
+ /**
606
+ * Change the user and/or group of a file or directory.
607
+ *
608
+ * @param fs The configured filesystem handle.
609
+ * @param path the path to the file or directory
610
+ * @param owner User string. Set to NULL for 'no change'
611
+ * @param group Group string. Set to NULL for 'no change'
612
+ * @return 0 on success else -1
613
+ */
614
+ int hdfsChown(hdfsFS fs, const char* path, const char *owner,
615
+ const char *group);
616
+
617
+ /**
618
+ * hdfsChmod
619
+ * @param fs The configured filesystem handle.
620
+ * @param path the path to the file or directory
621
+ * @param mode the bitmask to set it to
622
+ * @return 0 on success else -1
623
+ */
624
+ int hdfsChmod(hdfsFS fs, const char* path, short mode);
625
+
626
+ /**
627
+ * hdfsUtime
628
+ * @param fs The configured filesystem handle.
629
+ * @param path the path to the file or directory
630
+ * @param mtime new modification time or -1 for no change
631
+ * @param atime new access time or -1 for no change
632
+ * @return 0 on success else -1
633
+ */
634
+ int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime);
635
+
636
+ #ifdef __cplusplus
637
+ }
638
+ #endif
639
+
640
+ #endif /*LIBHDFS_HDFS_H*/
641
+
642
+ /**
643
+ * vim: ts=4: sw=4: et
644
+ */
645
+