What are the options (specific APIs) for uploading data (ie not files stored on disk)?
From my research so far I have identified:
Data <1MBFilesApi::get_local_payment_and_upload_chunk() will pay for and store a chunk (<~1MB).
Data >1MB I’m not aware of an API that will store data larger than a Chunk (other than from a file).
Missing APIs
I believe we need some new APIs for encrypting data in memory. The equivalents of the following for for a block of data rather than a file or file-tree:
Currently, in a POC for sn_httpd, I’m just storing data to a temp file, then uploading it. sn_httpd uses very similar code to sn_cli atm (as it was used for inspiration). FWIW, it does look like we should already be able to pay/upload chunk by chunk (sn_httpd/src/main.rs at 4bab513e7b43178e9fd7d16034d7c3e2d927e2e3 · traktion/sn_httpd · GitHub) with a bit of splitting/re-ordering of calls.
So, it looks like the self_encryption library would need to be improved to support streaming uploads from memory. However, it should be fine if the total data is stored in memory.
Given the total (file) size is also needed to know how to chunk the file, that could pose challenges (for streaming) too, i.e. if the total files size < 3 * MAX_CHUNK_SIZE, it is handled differently to those which are > 3 * MAX_CHUNK_SIZE. So, for now at least, the total data length would need to be known in advance (at least for aforementioned ranges).