From 60a1f0339620e43665fb946a1fc37b1ef590094e Mon Sep 17 00:00:00 2001 From: Michal Simon Date: Tue, 21 Jan 2020 15:53:48 +0100 Subject: [PATCH] [XrdCl] Create an interface for FD splicing. --- src/XrdCl/XrdClFile.cc | 23 +++++++++++++++++ src/XrdCl/XrdClFile.hh | 42 +++++++++++++++++++++++++++++++ src/XrdCl/XrdClPlugInInterface.hh | 15 +++++++++++ 3 files changed, 80 insertions(+) diff --git a/src/XrdCl/XrdClFile.cc b/src/XrdCl/XrdClFile.cc index 3485aba88dc..c763ef7a993 100644 --- a/src/XrdCl/XrdClFile.cc +++ b/src/XrdCl/XrdClFile.cc @@ -250,6 +250,29 @@ namespace XrdCl return status; } + //------------------------------------------------------------------------ + // Write a data chunk from a pipe at a given offset - async + //------------------------------------------------------------------------ + XRootDStatus File::Write( uint64_t offset, + uint32_t size, + DataPipe &pipe, + ResponseHandler *handler, + uint16_t timeout ) + { + return XRootDStatus( stError, errNotImplemented); + } + + //------------------------------------------------------------------------ + // Write a data chunk from a pipe at a given offset - sync + //------------------------------------------------------------------------ + XRootDStatus File::Write( uint64_t offset, + uint32_t size, + DataPipe &pipe, + uint16_t timeout ) + { + return XRootDStatus( stError, errNotImplemented ); + } + //---------------------------------------------------------------------------- // Commit all pending disk writes - async //---------------------------------------------------------------------------- diff --git a/src/XrdCl/XrdClFile.hh b/src/XrdCl/XrdClFile.hh index 78a2a843b47..4161dccf44e 100644 --- a/src/XrdCl/XrdClFile.hh +++ b/src/XrdCl/XrdClFile.hh @@ -37,6 +37,7 @@ namespace XrdCl { class FileStateHandler; class FilePlugIn; + class DataPipe; //---------------------------------------------------------------------------- //! A file @@ -232,6 +233,47 @@ namespace XrdCl uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; + //------------------------------------------------------------------------ + //! Write a data chunk from a pipe at a given offset - async + //! The call interprets and returns the server response, which may be + //! either a success or a failure, it does not contain the number + //! of bytes that were actually written. + //! + //! @param offset offset from the beginning of the file + //! @param size number of bytes to be written + //! @param buffer a pointer to the buffer holding the data to be written + //! @param handler handler to be notified when the response arrives + //! @param timeout timeout value, if 0 the environment default will be + //! used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Write( uint64_t offset, + uint32_t size, + DataPipe &pipe, + ResponseHandler *handler, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + + //------------------------------------------------------------------------ + //! Write a data chunk from a pipe at a given offset - sync + //! The call interprets and returns the server response, which may be + //! either a success or a failure, it does not contain the number + //! of bytes that were actually written. + //! + //! @param offset offset from the beginning of the file + //! @param size number of bytes to be written + //! @param buffer a pointer to the buffer holding the data to be + //! written + //! @param timeout timeout value, if 0 the environment default will + //! be used + //! @return status of the operation + //------------------------------------------------------------------------ + XRootDStatus Write( uint64_t offset, + uint32_t size, + DataPipe &pipe, + uint16_t timeout = 0 ) + XRD_WARN_UNUSED_RESULT; + //------------------------------------------------------------------------ //! Commit all pending disk writes - async //! diff --git a/src/XrdCl/XrdClPlugInInterface.hh b/src/XrdCl/XrdClPlugInInterface.hh index 7b09aab253c..bbbb64e8688 100644 --- a/src/XrdCl/XrdClPlugInInterface.hh +++ b/src/XrdCl/XrdClPlugInInterface.hh @@ -30,6 +30,8 @@ namespace XrdCl { + class DataPipe; + //---------------------------------------------------------------------------- //! An interface for file plug-ins //---------------------------------------------------------------------------- @@ -101,6 +103,19 @@ namespace XrdCl return XRootDStatus( stError, errNotImplemented ); } + //------------------------------------------------------------------------ + //! @see XrdCl::File::Write + //------------------------------------------------------------------------ + virtual XRootDStatus Write( uint64_t offset, + uint32_t size, + DataPipe &pipe, + ResponseHandler *handler, + uint16_t timeout = 0 ) + { + (void)offset; (void)size; (void)pipe; (void)handler; (void)timeout; + return XRootDStatus( stError, errNotImplemented ); + } + //------------------------------------------------------------------------ //! @see XrdCl::File::Sync //------------------------------------------------------------------------