]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: Remove the silly clientPointer convention from the Java.
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 22 Jul 2009 21:56:47 +0000 (14:56 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 22 Jul 2009 21:56:47 +0000 (14:56 -0700)
Since we're using libceph now it's unneeded and a waste of space.

src/client/hadoop/ceph/CephFileSystem.java
src/client/hadoop/ceph/CephInputStream.java
src/client/hadoop/ceph/CephOutputStream.java

index e1079bdf89f8f50932118a5ad9dc3577924097db..8ac56537ecfa5ef0554c596e1b0ad4e133070ed8 100644 (file)
@@ -55,55 +55,26 @@ public class CephFileSystem extends FileSystem {
    * include wrapper functions to automatically add the parameter.
    */ 
   
-  private boolean ceph_copyFromLocalFile(String localPath, String cephPath) 
-  { return ceph_copyFromLocalFile(clientPointer, localPath, cephPath); }
-  private boolean ceph_copyToLocalFile(String cephPath, String localPath)
-  { return ceph_copyToLocalFile(clientPointer, cephPath, localPath); }
-  private String  ceph_getcwd() { return ceph_getcwd(clientPointer); }  
-  private boolean ceph_setcwd(String path) { return ceph_setcwd(clientPointer, path); }
-  private boolean ceph_rmdir(String path) { return ceph_rmdir(clientPointer, path); }
-  private boolean ceph_mkdir(String path) { return ceph_mkdir(clientPointer, path); }
-  private boolean ceph_unlink(String path) { return ceph_unlink(clientPointer, path); }
-  private boolean ceph_rename(String old_path, String new_path) { return ceph_rename(clientPointer, old_path, new_path); } 
-  private boolean ceph_exists(String path) { return ceph_exists(clientPointer, path); }
-  private long    ceph_getblocksize(String path) { return ceph_getblocksize(clientPointer, path); }
-  private long    ceph_getfilesize(String path) { return ceph_getfilesize(clientPointer, path); }
-  private boolean ceph_isdirectory(String path) { return ceph_isdirectory(clientPointer, path); }
-  private boolean ceph_isfile(String path) { return ceph_isfile(clientPointer, path); }
-  private String[] ceph_getdir(String path) { return ceph_getdir(clientPointer, path); }
-  private int ceph_mkdirs(String path, int mode) { return ceph_mkdirs(clientPointer, path, mode); }
-  private int ceph_open_for_append(String path) { return ceph_open_for_append(clientPointer, path); }
-  private int ceph_open_for_read(String path) { return ceph_open_for_read(clientPointer, path); }
-  private int ceph_open_for_overwrite(String path, int mode) { return ceph_open_for_overwrite(clientPointer, path, mode); }
-
-  private boolean ceph_kill_client() {
-    System.out.println("Killing Ceph client with pointer " + clientPointer);
-    return ceph_kill_client(clientPointer);
-  }
-
   private native long    ceph_initializeClient();
-  private native boolean ceph_copyFromLocalFile (long client, String localPath, String cephPath);
-  private native boolean ceph_copyToLocalFile   (long client, String cephPath, String localPath);
-  private native String  ceph_getcwd            (long client);  
-  private native boolean ceph_setcwd            (long client, String path);
-  private native boolean ceph_rmdir             (long client, String path);
-  private native boolean ceph_mkdir             (long client, String path);
-  private native boolean ceph_unlink            (long client, String path);
-  private native boolean ceph_rename            (long client, String old_path, String new_path);
-  private native boolean ceph_exists            (long client, String path);
-  private native long    ceph_getblocksize      (long client, String path);
-  private native long    ceph_getfilesize       (long client, String path);
-  private native boolean ceph_isdirectory       (long client, String path);
-  private native boolean ceph_isfile            (long client, String path);
-  private native String[]ceph_getdir            (long client, String path);
-  private native int     ceph_mkdirs            (long client, String path, int mode);
-  private native int     ceph_open_for_append   (long client, String path);
-  private native int     ceph_open_for_read     (long client, String path);
-  private native int     ceph_open_for_overwrite(long client, String path, int mode);
-  private native boolean ceph_kill_client       (long client);
-
-
-
+  private native boolean ceph_copyFromLocalFile(String localPath, String cephPath);
+  private native boolean ceph_copyToLocalFile(String cephPath, String localPath);
+  private native String  ceph_getcwd();
+  private native boolean ceph_setcwd(String path);
+  private native boolean ceph_rmdir(String path);
+  private native boolean ceph_mkdir(String path);
+  private native boolean ceph_unlink(String path);
+  private native boolean ceph_rename(String old_path, String new_path);
+  private native boolean ceph_exists(String path);
+  private native long    ceph_getblocksize(String path);
+  private native long    ceph_getfilesize(String path);
+  private native boolean ceph_isdirectory(String path);
+  private native boolean ceph_isfile(String path);
+  private native String[] ceph_getdir(String path);
+  private native int ceph_mkdirs(String path, int mode);
+  private native int ceph_open_for_append(String path);
+  private native int ceph_open_for_read(String path);
+  private native int ceph_open_for_overwrite(String path, int mode);
+  private native boolean ceph_kill_client();
 
   public CephFileSystem() {
     root = new Path("/");
index 71b09e16e843b4ac93f02bb904b4e54960e25549..cd5823baf9496f17bb8f080beeab8f9d69facb56 100644 (file)
@@ -38,16 +38,10 @@ class CephInputStream extends FSInputStream {
 
   //private long blockEnd = -1;
 
-  private native int ceph_read(long client, int fh, byte[] buffer, int buffer_offset, int length);
-  private native long ceph_seek_from_start(long client, int fh, long pos);
-  private native long ceph_getpos(long client, int fh);
-  private native int ceph_close(long client, int fh);
-
-  private int ceph_read(byte[] buffer, int buffer_offset, int length)
-  { return ceph_read(clientPointer, fileHandle, buffer, buffer_offset, length); }
-  private long ceph_seek_from_start(long pos) { return ceph_seek_from_start(clientPointer, fileHandle, pos); }
-  private long ceph_getpos() { return ceph_getpos(clientPointer, fileHandle); }
-  private int ceph_close() { return ceph_close(clientPointer, fileHandle); }
+  private native int ceph_read(int fh, byte[] buffer, int buffer_offset, int length);
+  private native long ceph_seek_from_start(int fh, long pos);
+  private native long ceph_getpos(int fh);
+  private native int ceph_close(int fh);
     
   /*
     public S3InputStream(Configuration conf, FileSystemStore store,
@@ -78,7 +72,7 @@ class CephInputStream extends FSInputStream {
   }
 
   public synchronized long getPos() throws IOException {
-    return ceph_getpos();
+    return ceph_getpos(fileHandle);
   }
 
   @Override
@@ -93,7 +87,7 @@ class CephInputStream extends FSInputStream {
       throw new IOException("CephInputStream.seek: failed seeking to position " + targetPos +
                            " on fd " + fileHandle + ": Cannot seek after EOF " + fileLength);
     }
-    ceph_seek_from_start(targetPos);
+    ceph_seek_from_start(fileHandle, targetPos);
   }
 
   //failovers are handled by the Ceph code at a very low level;
@@ -146,7 +140,7 @@ class CephInputStream extends FSInputStream {
          return -1;
        }
       // actually do the read
-      int result = ceph_read(buf, off, len);
+      int result = ceph_read(fileHandle, buf, off, len);
       if (result < 0)
        System.out.println("CephInputStream.read: Reading " + len  + " bytes from fd " 
                           + fileHandle + " failed.");
@@ -166,7 +160,7 @@ class CephInputStream extends FSInputStream {
       throw new IOException("Stream closed");
     }
 
-    int result = ceph_close();
+    int result = ceph_close(fileHandle);
     if (result != 0) {
       throw new IOException("Close failed!");
     }
index 254c83830b4bc6a46e38c9c9bc7ec50ebd7c7042..916d1c19251208014bb93be3c05367ed194d3a1c 100644 (file)
@@ -54,21 +54,10 @@ class CephOutputStream extends OutputStream {
 
     
 
-  private long ceph_seek_from_start(long pos) {
-    return ceph_seek_from_start(clientPointer, fileHandle, pos);
-  }
-  private long ceph_getpos() {
-    return ceph_getpos(clientPointer, fileHandle);
-  }
-  private int ceph_close() { return ceph_close(clientPointer, fileHandle); }
-  private int ceph_write(byte[] buffer, int buffer_offset, int length)
-  { return ceph_write(clientPointer, fileHandle, buffer, buffer_offset, length); }
-
-
-  private native long ceph_seek_from_start(long client, int fh, long pos);
-  private native long ceph_getpos(long client, int fh);
-  private native int ceph_close(long client, int fh);
-  private native int ceph_write(long client, int fh, byte[] buffer, int buffer_offset, int length);
+  private native long ceph_seek_from_start(int fh, long pos);
+  private native long ceph_getpos(int fh);
+  private native int ceph_close(int fh);
+  private native int ceph_write(int fh, byte[] buffer, int buffer_offset, int length);
 
 
   /*  public CephOutputStream(Configuration conf, FileSystemStore store,
@@ -110,7 +99,7 @@ class CephOutputStream extends OutputStream {
 
     public long getPos() throws IOException {
     // change to get the position from Ceph client
-    return ceph_getpos();
+    return ceph_getpos(fileHandle);
   }
 
   // writes a byte
@@ -125,7 +114,7 @@ class CephOutputStream extends OutputStream {
       // Stick the byte in a buffer and write it
       byte buf[] = new byte[1];
       buf[0] = (byte) b;    
-      int result = ceph_write(buf, 0, 1);
+      int result = ceph_write(fileHandle, buf, 0, 1);
       if (1 != result)
        System.out.println("CephOutputStream.write: failed writing a single byte to fd "
                           + fileHandle + ": Ceph write() result = " + result);
@@ -157,7 +146,7 @@ class CephOutputStream extends OutputStream {
       }
 
       // write!
-      int result = ceph_write(buf, off, len);
+      int result = ceph_write(fileHandle, buf, off, len);
       if (result < 0) {
        throw new IOException("CephOutputStream.write: Write of " + len + 
                              "bytes to fd " + fileHandle + " failed");
@@ -184,7 +173,7 @@ class CephOutputStream extends OutputStream {
        throw new IOException("Stream closed");
       }
 
-      int result = ceph_close();
+      int result = ceph_close(fileHandle);
       if (result != 0) {
        throw new IOException("Close failed!");
       }