Class NfsWriteRequest

All Implemented Interfaces:
NfsRequest
Direct Known Subclasses:
Nfs3WriteRequest

public class NfsWriteRequest extends NfsRequestBase
The request, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

Procedure WRITE writes data to a file.

  • Field Details

    • UNSTABLE

      public static final int UNSTABLE
      The server is free to commit any part of the data and the metadata to stable storage, including all or none, before returning a reply to the client.
      See Also:
    • DATA_SYNC

      public static final int DATA_SYNC
      The server must commit all of the data to stable storage and enough of the metadata to retrieve the data before returning.
      See Also:
    • FILE_SYNC

      public static final int FILE_SYNC
      The server must commit the data written plus all file system metadata to stable storage before returning results.
      See Also:
  • Constructor Details

    • NfsWriteRequest

      public NfsWriteRequest(byte[] fileHandle, long offset, List<ByteBuffer> payload, int syncType, Credential credential, int nfsVersion) throws FileNotFoundException
      Creates the request, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure WRITE writes data to a file.

      Parameters:
      fileHandle - The file handle for the file to which data is to be written. This must identify a file system object of type, NF3REG.
      offset - The position within the file at which the write is to begin. An offset of 0 means to write data starting at the beginning of the file.
      payload - The data to be written to the file.
      syncType - One of the values below.
      • UNSTABLE = 0 - Best effort, no promises.
      • DATA_SYNC = 1 - Commit all data to stable storage, plus enough metadata for retrieval, before returning.
      • FILE_SYNC = 2 - Commit all data and metadata to stable storage before returning.
      credential - The credential used for RPC authentication.
      nfsVersion - The NFS version number
      Throws:
      FileNotFoundException
  • Method Details

    • marshalling

      public void marshalling(Xdr xdr)
      Writes the RPC call header and authentication credentials to the XDR buffer.
      Specified by:
      marshalling in interface NfsRequest
      Overrides:
      marshalling in class NfsRequestBase
      Parameters:
      xdr - the Xdr to be sent.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSize

      public int getSize()
      Returns the number of bytes of data to be written (calculated from the payload). If size is 0, the WRITE will succeed and return a count of 0, barring errors due to permissions checking. The size of data must be less than or equal to the value of the wtmax field in the FSINFO reply structure for the file system that contains file. If greater, the server may write only wtmax bytes, resulting in a short write.
    • isSync

      public boolean isSync()
      Returns
      • true if data is synced
      • false if it is not.
      .