|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The client of the file side channel (files/1, spec 6 §18): uploads and downloads through ui-file, one chunk of at most kMaxFileChunkBytes in flight at a time, reporting progress after each. More...
#include <service_client.hpp>
Public Member Functions | |
| FileTransfer (Exchange exchange, ::morph::session::Context session) | |
A transfer over exchange, its requests carrying session. | |
| void | upload (FileInfo info, std::string bytes, std::string model, std::string action, std::function< void(double)> progress, std::function< void(std::expected< std::string, std::string >)> done) const |
| Uploads a file, authorised as the mutation that will reference it. | |
| void | download (std::string ref, std::function< void(double)> progress, std::function< void(std::expected< DownloadedFile, std::string >)> done) const |
| Downloads a file by its reference. | |
The client of the file side channel (files/1, spec 6 §18): uploads and downloads through ui-file, one chunk of at most kMaxFileChunkBytes in flight at a time, reporting progress after each.
What it moves is bytes: reading the file the user picked is the platform's, and an application's InterpreterHost::upload reads it and hands the bytes here.
Definition at line 755 of file service_client.hpp.
|
inline |
A transfer over exchange, its requests carrying session.
| exchange | The transport. |
| session | The session every request carries. |
| std::invalid_argument | for an empty exchange. |
Definition at line 761 of file service_client.hpp.
|
inline |
Uploads a file, authorised as the mutation that will reference it.
| info | Its name, type and size; size is taken from bytes. |
| bytes | The file. |
| model | The model type of the mutation that will reference it. |
| action | That mutation's action. |
| progress | Called with 0 to 1 after each chunk; may be empty. |
| done | Called once with the file's reference, or why the upload failed. |
Definition at line 775 of file service_client.hpp.
|
inline |
Downloads a file by its reference.
| ref | The reference a reply carried. |
| progress | Called with 0 to 1 after each chunk; may be empty. |
| done | Called once with the file, or why the download failed. |
Definition at line 804 of file service_client.hpp.