Search in sources :

Example 1 with NfsTime

use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.

the class WccAttr method serialize.

public void serialize(XDR out) {
    out.writeLongAsHyper(size);
    if (mtime == null) {
        mtime = new NfsTime(0);
    }
    mtime.serialize(out);
    if (ctime == null) {
        ctime = new NfsTime(0);
    }
    ctime.serialize(out);
}
Also used : NfsTime(org.apache.hadoop.nfs.NfsTime)

Example 2 with NfsTime

use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.

the class WccAttr method deserialize.

public static WccAttr deserialize(XDR xdr) {
    long size = xdr.readHyper();
    NfsTime mtime = NfsTime.deserialize(xdr);
    NfsTime ctime = NfsTime.deserialize(xdr);
    return new WccAttr(size, mtime, ctime);
}
Also used : NfsTime(org.apache.hadoop.nfs.NfsTime)

Example 3 with NfsTime

use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.

the class SETATTR3Request method deserialize.

public static SETATTR3Request deserialize(XDR xdr) throws IOException {
    FileHandle handle = readHandle(xdr);
    SetAttr3 attr = new SetAttr3();
    attr.deserialize(xdr);
    boolean check = xdr.readBoolean();
    NfsTime ctime;
    if (check) {
        ctime = NfsTime.deserialize(xdr);
    } else {
        ctime = null;
    }
    return new SETATTR3Request(handle, attr, check, ctime);
}
Also used : FileHandle(org.apache.hadoop.nfs.nfs3.FileHandle) NfsTime(org.apache.hadoop.nfs.NfsTime)

Example 4 with NfsTime

use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.

the class TestNfsTime method testConstructor.

@Test
public void testConstructor() {
    NfsTime nfstime = new NfsTime(1001);
    Assert.assertEquals(1, nfstime.getSeconds());
    Assert.assertEquals(1000000, nfstime.getNseconds());
}
Also used : NfsTime(org.apache.hadoop.nfs.NfsTime) Test(org.junit.Test)

Example 5 with NfsTime

use of org.apache.hadoop.nfs.NfsTime in project hadoop by apache.

the class TestNfsTime method testSerializeDeserialize.

@Test
public void testSerializeDeserialize() {
    // Serialize NfsTime
    NfsTime t1 = new NfsTime(1001);
    XDR xdr = new XDR();
    t1.serialize(xdr);
    // Deserialize it back
    NfsTime t2 = NfsTime.deserialize(xdr.asReadOnlyWrap());
    // Ensure the NfsTimes are equal
    Assert.assertEquals(t1, t2);
}
Also used : XDR(org.apache.hadoop.oncrpc.XDR) NfsTime(org.apache.hadoop.nfs.NfsTime) Test(org.junit.Test)

Aggregations

NfsTime (org.apache.hadoop.nfs.NfsTime)8 FileHandle (org.apache.hadoop.nfs.nfs3.FileHandle)2 Nfs3FileAttributes (org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes)2 Test (org.junit.Test)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IOException (java.io.IOException)1 DFSClient (org.apache.hadoop.hdfs.DFSClient)1 HdfsFileStatus (org.apache.hadoop.hdfs.protocol.HdfsFileStatus)1 FSINFO3Request (org.apache.hadoop.nfs.nfs3.request.FSINFO3Request)1 FSINFO3Response (org.apache.hadoop.nfs.nfs3.response.FSINFO3Response)1 WccAttr (org.apache.hadoop.nfs.nfs3.response.WccAttr)1 XDR (org.apache.hadoop.oncrpc.XDR)1