ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
Public Member Functions | List of all members
daq::RsyncAsyncProcess Class Reference

Represents an rsync process as an asynchronous operation. More...

#include <rsyncAsyncProcess.hpp>

+ Inheritance diagram for daq::RsyncAsyncProcess:

Public Member Functions

virtual ~RsyncAsyncProcess ()
 
 RsyncAsyncProcess (boost::asio::io_context &ctx, std::string source, std::string dest, RsyncOptions const &opts={}, DryRun flag=DryRun::Disabled)
 Construct async operation. More...
 
- Public Member Functions inherited from daq::RsyncAsyncProcessIf
virtual ~RsyncAsyncProcessIf ()
 
- Public Member Functions inherited from daq::AsyncProcessIf
virtual ~AsyncProcessIf ()
 
- Public Member Functions inherited from daq::AsyncProcess
 AsyncProcess (boost::asio::io_context &ctx, std::vector< std::string > args)
 Constructor. More...
 
virtual ~AsyncProcess () noexcept
 
std::optional< pid_t > GetPid () const noexcept override
 Get PID. More...
 
std::error_code Abort () noexcept override
 Aborts the operation by terminating process which completes the operation. More...
 
std::error_code Signal (int sig) noexcept override
 Send signal to process. More...
 
bool IsRunning () const noexcept override
 
std::vector< std::string > const & GetArguments () const noexcept override
 
boost::signals2::connection ConnectStdout (SigOutStream::slot_type const &slot) override
 Signal type for stdout/stderr signals. More...
 
boost::signals2::connection ConnectStderr (SigOutStream::slot_type const &slot) override
 Signal type for stdout/stderr signals. More...
 

Signals

using SigProgress = RsyncAsyncProcessIf::SigProgress
 Progress update signal. More...
 
boost::future< int > Initiate () override
 Progress update signal. More...
 
boost::signals2::connection ConnectProgress (SigProgress::slot_type const &slot) override
 Connect to progress signal. More...
 

Additional Inherited Members

- Public Types inherited from daq::RsyncAsyncProcessIf
enum  DryRun { DryRun::Disabled = 0, DryRun::Enabled }
 
using SigProgress = boost::signals2::signal< void(pid_t, RsyncProgress const &)>
 Progress update signal. More...
 
- Public Types inherited from daq::AsyncProcessIf
using SigOutStream = boost::signals2::signal< void(pid_t, std::string const &)>
 Signal type for stdout/stderr signals. More...
 
- Public Types inherited from daq::AsyncProcess
using SigOutStream = boost::signals2::signal< void(pid_t, std::string const &)>
 Signal type for stdout/stderr signals. More...
 

Detailed Description

Represents an rsync process as an asynchronous operation.

Once constructed the operation is initiated (only once) with Initiate() which starts the process and returns a boost::future object that will receive exit code when process terminates and all output has been read.

Note
No signals will be emitted after future has received the value or exception.

Operation can be aborted with Abort() which will terminate process and set future with exceptional result.

Definition at line 116 of file rsyncAsyncProcess.hpp.

Member Typedef Documentation

◆ SigProgress

Progress update signal.

Definition at line 146 of file rsyncAsyncProcess.hpp.

Constructor & Destructor Documentation

◆ ~RsyncAsyncProcess()

daq::RsyncAsyncProcess::~RsyncAsyncProcess ( )
virtual

Definition at line 115 of file rsyncAsyncProcess.cpp.

◆ RsyncAsyncProcess()

daq::RsyncAsyncProcess::RsyncAsyncProcess ( boost::asio::io_context &  ctx,
std::string  source,
std::string  dest,
RsyncOptions const &  opts = {},
DryRun  flag = DryRun::Disabled 
)

Construct async operation.

Note
Does not start the process or any other asynchronous operations. This is done in AsyncProcess::Initiate().
Parameters
ctxio_context instance to use.
sourcersync file source.
destrsync file dest.
optsrsync options.
flagControl whether rsync should do a dry-run (useful to test if connection is possible).

Definition at line 107 of file rsyncAsyncProcess.cpp.

Member Function Documentation

◆ ConnectProgress()

boost::signals2::connection daq::RsyncAsyncProcess::ConnectProgress ( SigProgress::slot_type const &  slot)
overridevirtual

Connect to progress signal.

Implements daq::RsyncAsyncProcessIf.

Definition at line 129 of file rsyncAsyncProcess.cpp.

◆ Initiate()

boost::future< int > daq::RsyncAsyncProcess::Initiate ( )
overridevirtual

Progress update signal.

Reimplemented from daq::AsyncProcess.

Definition at line 118 of file rsyncAsyncProcess.cpp.


The documentation for this class was generated from the following files: