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.

Template Parameters
  • TransferEntryClass: class which implements the file transfer logic for a single file to one receiver

  • SessionClass: The concrete class which implements the actual output

Public Functions

FileTransferManager()

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

FileTransferManager(WorkQueueInterface *workDispatcher)

Constructor.

Parameters
  • workDispatcher: The instance which manages the execution of work items in asynchronous manner

~FileTransferManager()

dtor

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

Cancel transferring a file to specific receiver.

Return

True if there was a match and an entry was canceled

Parameters
  • uri: Identifies the file

  • session: Identifies the receiver

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

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

void setWorkDispatcher(WorkQueueInterface *workDispatcher)

Set the work dispatcher.

Parameters
  • workDispatcher: The instance which manages the execution of work items in asynchronous manner