~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/client/hadoop/ceph/CephTalker.java

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode:Java; tab-width:2; c-basic-offset:2; indent-tabs-mode:t -*- 
 
2
 
 
3
/**
 
4
 *
 
5
 * Licensed under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License. You may obtain a copy of the License at
 
8
 *
 
9
 * http://www.apache.org/licenses/LICENSE-2.0
 
10
 *
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 
14
 * implied. See the License for the specific language governing
 
15
 * permissions and limitations under the License.
 
16
 *
 
17
 * 
 
18
 * Wraps a number of native function calls to communicate with the Ceph
 
19
 * filesystem.
 
20
 */
 
21
package org.apache.hadoop.fs.ceph;
 
22
 
 
23
 
 
24
import org.apache.hadoop.conf.Configuration;
 
25
import org.apache.commons.logging.Log;
 
26
 
 
27
 
 
28
class CephTalker extends CephFS {
 
29
  // JNI doesn't give us any way to store pointers, so use a long.
 
30
  // Here we're assuming pointers aren't longer than 8 bytes.
 
31
  long cluster;
 
32
 
 
33
  // we write a constructor so we can load the libraries
 
34
  public CephTalker(Configuration conf, Log log) {
 
35
    System.load(conf.get("fs.ceph.libDir") + "/libcephfs.so");
 
36
    System.load(conf.get("fs.ceph.libDir") + "/libhadoopcephfs.so");
 
37
    cluster = 0;
 
38
  }
 
39
 
 
40
  protected native boolean ceph_initializeClient(String arguments, int block_size);
 
41
 
 
42
  protected native String ceph_getcwd();
 
43
 
 
44
  protected native boolean ceph_setcwd(String path);
 
45
 
 
46
  protected native boolean ceph_rmdir(String path);
 
47
 
 
48
  protected native boolean ceph_unlink(String path);
 
49
 
 
50
  protected native boolean ceph_rename(String old_path, String new_path);
 
51
 
 
52
  protected native boolean ceph_exists(String path);
 
53
 
 
54
  protected native long ceph_getblocksize(String path);
 
55
 
 
56
  protected native boolean ceph_isdirectory(String path);
 
57
 
 
58
  protected native boolean ceph_isfile(String path);
 
59
 
 
60
  protected native String[] ceph_getdir(String path);
 
61
 
 
62
  protected native int ceph_mkdirs(String path, int mode);
 
63
 
 
64
  protected native int ceph_open_for_append(String path);
 
65
 
 
66
  protected native int ceph_open_for_read(String path);
 
67
 
 
68
  protected native int ceph_open_for_overwrite(String path, int mode);
 
69
 
 
70
  protected native int ceph_close(int filehandle);
 
71
 
 
72
  protected native boolean ceph_setPermission(String path, int mode);
 
73
 
 
74
  protected native boolean ceph_kill_client();
 
75
 
 
76
  protected native boolean ceph_stat(String path, CephFileSystem.Stat fill);
 
77
 
 
78
  protected native int ceph_replication(String Path);
 
79
 
 
80
  protected native String[] ceph_hosts(int fh, long offset);
 
81
 
 
82
  protected native int ceph_setTimes(String path, long mtime, long atime);
 
83
 
 
84
  protected native long ceph_getpos(int fh);
 
85
 
 
86
  protected native int ceph_write(int fh, byte[] buffer, int buffer_offset, int length);
 
87
 
 
88
  protected native int ceph_read(int fh, byte[] buffer, int buffer_offset, int length);
 
89
 
 
90
  protected native long ceph_seek_from_start(int fh, long pos);
 
91
}