fileservice::FileTransferManager

template<typename TransferEntryClass, typename SessionClass>
class kanzi::connect::fileservice::FileTransferManager

Manages file transfers which can be split into one or more portions to avoid sending large files at once.

tparam TransferEntryClass

class which implements the file transfer logic for a single file to one receiver

tparam SessionClass

The concrete class which implements the actual output

Public Functions

inline FileTransferManager()

ctor Usage of the ctor requires setting the WorkQueueInterface later on before using the class

inline explicit FileTransferManager(WorkQueueInterface *workDispatcher)

Constructor.

Parameters

workDispatcher – The instance which manages the execution of work items in asynchronous manner

inline ~FileTransferManager()

dtor

inline bool cancelTransfer(const string &uri, shared_ptr<SessionClass> session)

Cancel transferring a file to specific receiver.

Parameters
  • uri – Identifies the file

  • session – Identifies the receiver

Returns

True if there was a match and an entry was canceled

inline void initiateTransfer(const string &uri, vector<char> &buffer, unsigned int handle, shared_ptr<SessionClass> session, unsigned int blockSize, unsigned int timeout_ms)

Start transferring the given buffer.

Parameters
  • uri – The identifier of the file network-wide

  • buffer – The contents to transfer

  • handle – Identifies the transfer between sender and receiver

  • session – Implements the actual output

  • blockSize – In what size chunks to transfer the buffer

  • timeout_ms – Tell the receiver how long to wait for transfer to finish

inline void progressFileTransfer(const unsigned int handle)

Send the next chunk from the buffer This should be repeatedly called until the transfer has finished.

Parameters

handle – Identifies the transfer to progress

inline void setWorkDispatcher(WorkQueueInterface *workDispatcher)

Set the work dispatcher.

Parameters

workDispatcher – The instance which manages the execution of work items in asynchronous manner