Search in sources :

Example 41 with FileHandle

use of org.apache.hadoop.nfs.nfs3.FileHandle in project hadoop by apache.

the class READDIR3Request method deserialize.

public static READDIR3Request deserialize(XDR xdr) throws IOException {
    FileHandle handle = readHandle(xdr);
    long cookie = xdr.readHyper();
    long cookieVerf = xdr.readHyper();
    int count = xdr.readInt();
    return new READDIR3Request(handle, cookie, cookieVerf, count);
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle)

Example 42 with FileHandle

use of org.apache.hadoop.nfs.nfs3.FileHandle in project hadoop by apache.

the class READDIRPLUS3Request method deserialize.

public static READDIRPLUS3Request deserialize(XDR xdr) throws IOException {
    FileHandle handle = readHandle(xdr);
    long cookie = xdr.readHyper();
    long cookieVerf = xdr.readHyper();
    int dirCount = xdr.readInt();
    int maxCount = xdr.readInt();
    return new READDIRPLUS3Request(handle, cookie, cookieVerf, dirCount, maxCount);
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle)

Example 43 with FileHandle

use of org.apache.hadoop.nfs.nfs3.FileHandle in project hadoop by apache.

the class TestFileHandle method testConstructor.

@Test
public void testConstructor() {
    FileHandle handle = new FileHandle(1024);
    XDR xdr = new XDR();
    handle.serialize(xdr);
    Assert.assertEquals(handle.getFileId(), 1024);
    // Deserialize it back 
    FileHandle handle2 = new FileHandle();
    handle2.deserialize(xdr.asReadOnlyWrap());
    Assert.assertEquals("Failed: Assert 1024 is id ", 1024, handle.getFileId());
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle) XDR(org.apache.hadoop.oncrpc.XDR) Test(org.junit.Test)

Example 44 with FileHandle

use of org.apache.hadoop.nfs.nfs3.FileHandle in project hadoop by apache.

the class SYMLINK3Request method deserialize.

public static SYMLINK3Request deserialize(XDR xdr) throws IOException {
    FileHandle handle = readHandle(xdr);
    String name = xdr.readString();
    SetAttr3 symAttr = new SetAttr3();
    symAttr.deserialize(xdr);
    String symData = xdr.readString();
    return new SYMLINK3Request(handle, name, symAttr, symData);
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle)

Example 45 with FileHandle

use of org.apache.hadoop.nfs.nfs3.FileHandle in project hadoop by apache.

the class CREATE3Response method deserialize.

public static CREATE3Response deserialize(XDR xdr) {
    int status = xdr.readInt();
    FileHandle objHandle = new FileHandle();
    Nfs3FileAttributes postOpObjAttr = null;
    if (status == Nfs3Status.NFS3_OK) {
        xdr.readBoolean();
        objHandle.deserialize(xdr);
        xdr.readBoolean();
        postOpObjAttr = Nfs3FileAttributes.deserialize(xdr);
    }
    WccData dirWcc = WccData.deserialize(xdr);
    return new CREATE3Response(status, objHandle, postOpObjAttr, dirWcc);
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle) Nfs3FileAttributes(org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes)

Aggregations

FileHandle (org.apache.hadoop.nfs.nfs3.FileHandle)79 HdfsFileStatus (org.apache.hadoop.hdfs.protocol.HdfsFileStatus)34 XDR (org.apache.hadoop.oncrpc.XDR)34 Nfs3FileAttributes (org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes)31 Test (org.junit.Test)31 InetSocketAddress (java.net.InetSocketAddress)28 DFSClient (org.apache.hadoop.hdfs.DFSClient)26 IOException (java.io.IOException)24 VisibleForTesting (com.google.common.annotations.VisibleForTesting)19 WccData (org.apache.hadoop.nfs.nfs3.response.WccData)12 SetAttr3 (org.apache.hadoop.nfs.nfs3.request.SetAttr3)11 WRITE3Request (org.apache.hadoop.nfs.nfs3.request.WRITE3Request)8 NfsConfiguration (org.apache.hadoop.hdfs.nfs.conf.NfsConfiguration)7 HdfsDataOutputStream (org.apache.hadoop.hdfs.client.HdfsDataOutputStream)6 CREATE3Request (org.apache.hadoop.nfs.nfs3.request.CREATE3Request)6 READ3Request (org.apache.hadoop.nfs.nfs3.request.READ3Request)5 CREATE3Response (org.apache.hadoop.nfs.nfs3.response.CREATE3Response)5 READ3Response (org.apache.hadoop.nfs.nfs3.response.READ3Response)5 WRITE3Response (org.apache.hadoop.nfs.nfs3.response.WRITE3Response)5 VerifierNone (org.apache.hadoop.oncrpc.security.VerifierNone)5