|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Where uploaded and issued files live. Every call names the principal it is made for, and an upload id or a file reference works only for the principal it was made for. More...
#include <file_store.hpp>
Public Member Functions | |
| IFileStore (IFileStore const &)=delete | |
| IFileStore & | operator= (IFileStore const &)=delete |
| IFileStore (IFileStore &&)=delete | |
| IFileStore & | operator= (IFileStore &&)=delete |
| virtual std::expected< std::string, FileError > | begin (std::string const &principal, FileInfo info)=0 |
| Starts an upload. | |
| virtual std::expected< std::size_t, FileError > | append (std::string const &principal, std::string const &upload, std::size_t offset, std::string_view bytes)=0 |
| Appends a chunk to an upload. | |
| virtual std::expected< std::string, FileError > | finish (std::string const &principal, std::string const &upload)=0 |
| Ends an upload and files it. | |
| virtual std::expected< std::string, FileError > | issue (std::string const &principal, FileInfo info, std::string bytes)=0 |
| Files bytes the server made for a principal, such as a report a reply returns. | |
| virtual std::expected< FileSlice, FileError > | read (std::string const &principal, std::string const &ref, std::size_t offset, std::size_t length)=0 |
| Reads a slice of a file. | |
Where uploaded and issued files live. Every call names the principal it is made for, and an upload id or a file reference works only for the principal it was made for.
A reference is a capability: whoever presents it, as the principal it belongs to, may read the file. It is therefore unguessable (newFileRef), and a store answers a reference of another principal exactly as one that does not exist.
Definition at line 78 of file file_store.hpp.
|
nodiscardpure virtual |
Starts an upload.
| principal | The uploader. |
| info | The file's name, type and size. |
Implemented in morph::ui::MemoryFileStore.
|
nodiscardpure virtual |
Appends a chunk to an upload.
| principal | The uploader. |
| upload | The upload id. |
| offset | Where the chunk starts: the bytes received so far. |
| bytes | The chunk. |
Implemented in morph::ui::MemoryFileStore.
|
nodiscardpure virtual |
Ends an upload and files it.
| principal | The uploader. |
| upload | The upload id. |
Implemented in morph::ui::MemoryFileStore.
|
nodiscardpure virtual |
Files bytes the server made for a principal, such as a report a reply returns.
| principal | The principal the reference is for. |
| info | The file's name and type; size is taken from bytes. |
| bytes | The file. |
Implemented in morph::ui::MemoryFileStore.
|
nodiscardpure virtual |
Reads a slice of a file.
| principal | The reader. |
| ref | The file's reference. |
| offset | The first byte. |
| length | At most this many bytes. |
Implemented in morph::ui::MemoryFileStore.