IRPCFileTransferStreaming.FileUploadBlock
Vault API / standard write session or assertion client streaming
Uploads one block of a stateless file upload by streaming its data.
The file is started with FileUploadBegin, its blocks are uploaded with this method and the file is completed with FileUploadEnd (IRPCFileTransfer). The block data is sent as a stream of chunks, so neither the client nor the server needs to have the whole block in one message.
The client sends the messages in the following order:
- One header message.
- Any number of file_data messages containing the block data in order.
- One end message. The block is stored only when the end message has been received. If the request stream ends without the end message, the call fails and the block must be uploaded again.
The server streams the data forward with a single request while it is received. The block size is limited by the maxBlockSize returned by FileUploadBegin. Blocks may be uploaded in any order and concurrently, also to different server instances. Uploading a block again replaces it.
The data should be sent in chunks of a few megabytes at most. Each file_data message is limited by the maximum gRPC message size of the server.
| Service | Streaming file upload MFiles.IRPCFileTransferStreaming |
|---|---|
| gRPC method | /MFiles.IRPCFileTransferStreaming/FileUploadBlock |
| HTTP (mf-http-grpc) | POST /grpc/v1/file-upload-block |
| Request | FileUploadBlockRequest |
| Response | FileUploadBlockResponse |
| Book and level | Vault API, standard |
| Kind | write |
| Session | Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata). |
| Idempotent | no |
| Returns metadata structure version | no |
| Streaming | client |
Remarks
Begin the upload with FileUploadBegin and
follow its max_block_size and require_sequential_blocks. A block index must be less than
50,000 and a block must not be empty.
Request: FileUploadBlockRequest
A message of the FileUploadBlock request stream.
Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.
| Field | Type | Description |
|---|---|---|
header | FileUploadBlockHeader (oneof item) | The first message of the stream. Describes the block. |
header.file_ref | string | The file_ref received from FileUploadBegin. |
header.block_index | int64 | The zero-based index of the block within the file, in content order. Must be less than 50 000. |
header.block_size | uint64 | The size of the block data in bytes. Required. The data must be exactly this size and must not exceed the maxBlockSize returned by FileUploadBegin. |
file_data | bytes (oneof item) | A chunk of the block data. |
end | FileUploadBlockEnd (oneof item) | The last message of the stream. Marks the block as complete. |
Response: FileUploadBlockResponse
The response of the FileUploadBlock streaming method.
No fields.
Related methods
- IRPCFileTransfer.FileUploadBegin -- Begins an upload in blocks and returns its
file_refand the block rules.