Today, if you wanted to upload a file over the
uavcan.file.* protocols, you can do the follow order or operations:
uavcan.file.Modify to configure as a “Touch” to create the file & parent directories. If the server is running out of resources it can be determined early here.
block_size times until the file is uploaded, then send the “EOF” call)
A failure could occur very far into the upload where the File System (or an emulation of one) could run out of space.
The “EOF” call of the
uavcan.file.Write message is documented as being sent at the end of the file to notate that all the data has been sent and to truncate any other existing data (if a resize is needed).
Is the intent to also use the EOF style to “reserve” the file space as well?
uavcan.file.Modify (as “Touch”)
uavcan.file.Write (as “EOF” w/ intended size)
a. does it fill the file with undefined bytes? or
b. Does it simply ask if there is enough room to support a file of that size? (it can respond with FILE_TOO_LARGE)
uavcan.file.Write (file data transactions + another “EOF” to note the end transactions).
Proposed specification change for the wording of
Write into a remote file.
The server shall place the contents of the field ‘data’ into the file pointed by ‘path’ at the offset specified by the field ‘offset’.
[new] Before writing the file, the sender may test to see if the receiving end can contain the intended size of the file by sending a request with the offset field set to the size of the file and the data field empty. The server can then inform the client if the file size would be possible at the time of the request. This would not necessarily be guaranteed in subsequent transactions but the server may pre-allocate that memory if the implementation could support that.
When writing a file, the client should repeatedly call this service with data while advancing the offset until the file is written completely. When the write sequence is completed, the client shall call the service one last time, with the offset set to the size of the file and with the data field empty, which will signal the server that the transfer is finished.
When the write operation is complete, the server shall truncate the resulting file past the specified offset.